LfsAuthTokenTest: truncate instant to millis
Java8 offers millis precision for instant however Java9+ goes further
and offers micro (6 digits).
There is no need to increase LFS auth token precision to micro
therefore truncate instant to millis for serialization and
deserialization tests.
Bug: Issue 13849
Change-Id: Icc49611879a125585385c4dc0da975871518d68a
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 f527aab..f38120b 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
@@ -16,6 +16,7 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
+import static java.time.temporal.ChronoUnit.MILLIS;
import com.googlesource.gerrit.plugins.lfs.LfsDateTime;
import java.time.Instant;
@@ -30,7 +31,7 @@
@Test
public void testTokenSerializationDeserialization() throws Exception {
TestTokenProessor processor = new TestTokenProessor(cipher);
- TestToken token = new TestToken(Instant.now(), 0L);
+ TestToken token = new TestToken(Instant.now().truncatedTo(MILLIS), 0L);
String serialized = processor.serialize(token);
assertThat(serialized).isNotEmpty();
Optional<TestToken> deserialized = processor.deserialize(serialized);