diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-12-28 23:46:48 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-12-29 01:47:54 +0100 |
commit | 09f98fd56731250ea17b99a6511c046eaff1b81a (patch) | |
tree | d74166cf376161b8304e19cf3df0d7689fd68b5e | |
parent | 085b24aaf416308634388038ab186d22cc51a806 (diff) | |
download | jgit-09f98fd56731250ea17b99a6511c046eaff1b81a.tar.gz jgit-09f98fd56731250ea17b99a6511c046eaff1b81a.zip |
ChangeIdUtilTest: use java.time instead of java.util.Date API
Change-Id: Ideb32d24c78aa8f42546d9098991257ab6f205c4
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java index 32652494d2..e7f2049bb9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java @@ -12,7 +12,9 @@ package org.eclipse.jgit.util; import static org.junit.Assert.assertEquals; -import java.util.concurrent.TimeUnit; +import java.time.Duration; +import java.time.Instant; +import java.time.ZoneId; import org.eclipse.jgit.junit.MockSystemReader; import org.eclipse.jgit.lib.ObjectId; @@ -53,9 +55,9 @@ public class ChangeIdUtilTest { MockSystemReader mockSystemReader = new MockSystemReader(); - final long when = mockSystemReader.getCurrentTime(); + Instant when = mockSystemReader.now(); - final int tz = new MockSystemReader().getTimezone(when); + ZoneId tz = new MockSystemReader().getTimeZoneAt(when); PersonIdent author = new PersonIdent("J. Author", "ja@example.com"); { @@ -342,9 +344,7 @@ public class ChangeIdUtilTest { /** Increment the {@link #author} and {@link #committer} times. */ protected void tick() { - final long delta = TimeUnit.MILLISECONDS.convert(5 * 60, - TimeUnit.SECONDS); - final long now = author.getWhen().getTime() + delta; + Instant now = author.getWhenAsInstant().plus(Duration.ofMinutes(5)); author = new PersonIdent(author, now, tz); committer = new PersonIdent(committer, now, tz); |