From f25741f68940ef8fa086526a1f03a103f74d7517 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Thu, 26 Sep 2024 18:00:06 +0200 Subject: [PATCH] Update MockTwilightTimeTest to use the new format --- .../eu/m724/wtapi/twilight/MockTwilightTimeProvider.java | 6 ++++-- .../java/eu/m724/wtapi/twilight/MockTwilightTimeTest.java | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeProvider.java b/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeProvider.java index 138b21b..dcb27e4 100644 --- a/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeProvider.java +++ b/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeProvider.java @@ -6,6 +6,8 @@ import eu.m724.wtapi.provider.twilight.TwilightTimeProvider; import java.time.Duration; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; public class MockTwilightTimeProvider extends TwilightTimeProvider { @Override @@ -13,8 +15,8 @@ public class MockTwilightTimeProvider extends TwilightTimeProvider { int time = (int) (coordinates.latitude + coordinates.longitude); return new Twilight( date, - Duration.ofMinutes(-time), - Duration.ofMinutes(time) + date.atStartOfDay().plusSeconds(-time), + date.atStartOfDay().plusSeconds(time) ); } } diff --git a/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeTest.java b/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeTest.java index 48e3433..3141a36 100644 --- a/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeTest.java +++ b/src/test/java/eu/m724/wtapi/twilight/MockTwilightTimeTest.java @@ -17,7 +17,10 @@ public class MockTwilightTimeTest { Twilight twilight = provider.calculateTwilightTime(date, coordinates); assert twilight.date().equals(date); - assert twilight.sunrise().getSeconds() == -6840; - assert twilight.sunset().getSeconds() == 6840; + // this might make no sense but just a test remember + assert twilight.sunrise().getDayOfMonth() == 19; + assert twilight.sunrise().toLocalTime().toSecondOfDay() == 86286; + assert twilight.sunset().getDayOfMonth() == 20; + assert twilight.sunset().toLocalTime().toSecondOfDay() == 114; } }