Use Truth8 to assert about Optional#isPresent
Change-Id: Idec49a6aa81c3031f72b5a8ffced719da98aeb1e
diff --git a/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsAuthTokenTest.java b/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsAuthTokenTest.java
index bdf7c21..f527aab 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsAuthTokenTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsAuthTokenTest.java
@@ -15,6 +15,7 @@
package com.googlesource.gerrit.plugins.lfs.auth;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth8.assertThat;
import com.googlesource.gerrit.plugins.lfs.LfsDateTime;
import java.time.Instant;
@@ -33,7 +34,7 @@
String serialized = processor.serialize(token);
assertThat(serialized).isNotEmpty();
Optional<TestToken> deserialized = processor.deserialize(serialized);
- assertThat(deserialized.isPresent()).isTrue();
+ assertThat(deserialized).isPresent();
assertThat(token.issued).isEqualTo(deserialized.get().issued);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsCipherTest.java b/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsCipherTest.java
index b3c132a..3072767 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsCipherTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/lfs/auth/LfsCipherTest.java
@@ -15,6 +15,7 @@
package com.googlesource.gerrit.plugins.lfs.auth;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth8.assertThat;
import java.util.Optional;
import org.junit.Test;
@@ -35,7 +36,7 @@
public void testVerifyDecodeAgainstEncodedInput() throws Exception {
String encrypted = cipher.encrypt(PLAIN_TEXT);
Optional<String> decrypted = cipher.decrypt(encrypted);
- assertThat(decrypted.isPresent()).isTrue();
+ assertThat(decrypted).isPresent();
assertThat(decrypted.get()).isEqualTo(PLAIN_TEXT);
}
@@ -51,7 +52,7 @@
Optional<String> decrypted =
cipher.decrypt(
encrypted.substring(1, 2) + encrypted.substring(0, 1) + encrypted.substring(2));
- assertThat(decrypted.isPresent()).isTrue();
+ assertThat(decrypted).isPresent();
assertThat(decrypted.get()).isNotEqualTo(PLAIN_TEXT);
}
}