use of org.threeten.bp.Clock in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_getShowReleaseDateTime_dstGap.
@Test
public void test_getShowReleaseDateTime_dstGap() {
// using begin of daylight saving time in Europe/Berlin on 2017-03-26
// clock moves forward at 2:00 by 1 hour
ZoneId zoneIdBerlin = ZoneId.of(EUROPE_BERLIN);
Instant instantDayOfDstStart = ZonedDateTime.of(LocalDateTime.of(2017, 3, 26, 1, 0), zoneIdBerlin).toInstant();
Clock fixedClock = Clock.fixed(instantDayOfDstStart, zoneIdBerlin);
// put show release exactly inside daylight saving gap (02:00-03:00)
ZonedDateTime dateTime = TimeTools.getShowReleaseDateTime(LocalTime.of(2, 30), DayOfWeek.SUNDAY.getValue(), zoneIdBerlin, GERMANY, "Some Network", fixedClock);
// time should be "fixed" by moving an hour forward
assertThat(dateTime.toLocalTime()).isEqualTo(LocalTime.of(3, 30));
}
Aggregations