From 9df4831f8eff4cc04311a958d2aa0cb1fdbc9ac1 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 26 Dec 2024 00:01:31 +0100 Subject: TransportHttpTest: use java.time API We are moving away from the old java.util.Date API to the java.time API. Change-Id: I6d2ff9d0dfb81ca8385f8776e3fa73e090247b79 --- .../tst/org/eclipse/jgit/transport/TransportHttpTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java index 029b45e1e6..96d3a5835a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportHttpTest.java @@ -14,10 +14,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.io.IOException; import java.net.HttpCookie; +import java.time.Duration; import java.time.Instant; import java.util.Arrays; import java.util.Collections; -import java.util.Date; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; @@ -101,7 +101,7 @@ public class TransportHttpTest extends SampleDataRepositoryTestCase { .singletonList("cookie2=some value; Max-Age=1234; Path=/")); try (TransportHttp transportHttp = new TransportHttp(db, uri)) { - Date creationDate = new Date(); + Instant creationDate = Instant.now(); transportHttp.processResponseCookies(connection); // evaluate written cookie file @@ -112,8 +112,9 @@ public class TransportHttpTest extends SampleDataRepositoryTestCase { cookie.setPath("/u/2/"); cookie.setMaxAge( - (Instant.parse("2100-01-01T11:00:00.000Z").toEpochMilli() - - creationDate.getTime()) / 1000); + Duration.between(creationDate, + Instant.parse("2100-01-01T11:00:00.000Z")) + .getSeconds()); cookie.setSecure(true); cookie.setHttpOnly(true); expectedCookies.add(cookie); -- cgit v1.2.3