Update MockTwilightTimeTest to use the new format
This commit is contained in:
parent
bdb3404c3d
commit
f25741f689
2 changed files with 9 additions and 4 deletions
|
@ -6,6 +6,8 @@ import eu.m724.wtapi.provider.twilight.TwilightTimeProvider;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
public class MockTwilightTimeProvider extends TwilightTimeProvider {
|
public class MockTwilightTimeProvider extends TwilightTimeProvider {
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,8 +15,8 @@ public class MockTwilightTimeProvider extends TwilightTimeProvider {
|
||||||
int time = (int) (coordinates.latitude + coordinates.longitude);
|
int time = (int) (coordinates.latitude + coordinates.longitude);
|
||||||
return new Twilight(
|
return new Twilight(
|
||||||
date,
|
date,
|
||||||
Duration.ofMinutes(-time),
|
date.atStartOfDay().plusSeconds(-time),
|
||||||
Duration.ofMinutes(time)
|
date.atStartOfDay().plusSeconds(time)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,10 @@ public class MockTwilightTimeTest {
|
||||||
Twilight twilight = provider.calculateTwilightTime(date, coordinates);
|
Twilight twilight = provider.calculateTwilightTime(date, coordinates);
|
||||||
|
|
||||||
assert twilight.date().equals(date);
|
assert twilight.date().equals(date);
|
||||||
assert twilight.sunrise().getSeconds() == -6840;
|
// this might make no sense but just a test remember
|
||||||
assert twilight.sunset().getSeconds() == 6840;
|
assert twilight.sunrise().getDayOfMonth() == 19;
|
||||||
|
assert twilight.sunrise().toLocalTime().toSecondOfDay() == 86286;
|
||||||
|
assert twilight.sunset().getDayOfMonth() == 20;
|
||||||
|
assert twilight.sunset().toLocalTime().toSecondOfDay() == 114;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue