use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_compareTo_sameInstant.
@Test
public void test_compareTo_sameInstant() {
ZoneOffsetTransition a = ZoneOffsetTransition.of(LocalDateTime.ofEpochSecond(23875287L, 0, OFFSET_0200), OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition b = ZoneOffsetTransition.of(LocalDateTime.ofEpochSecond(23875287L, 0, OFFSET_0300), OFFSET_0300, OFFSET_0200);
ZoneOffsetTransition c = ZoneOffsetTransition.of(LocalDateTime.ofEpochSecond(23875287L, 0, OFFSET_0100), OFFSET_0100, OFFSET_0400);
assertEquals(a.compareTo(a) == 0, true);
assertEquals(a.compareTo(b) == 0, true);
assertEquals(a.compareTo(c) == 0, true);
assertEquals(b.compareTo(a) == 0, true);
assertEquals(b.compareTo(b) == 0, true);
assertEquals(b.compareTo(c) == 0, true);
assertEquals(c.compareTo(a) == 0, true);
assertEquals(c.compareTo(b) == 0, true);
assertEquals(c.compareTo(c) == 0, true);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_isValidOffset_overlap.
@Test
public void test_isValidOffset_overlap() {
LocalDateTime ldt = LocalDateTime.of(2010, 10, 31, 1, 0);
ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, OFFSET_0300, OFFSET_0200);
assertEquals(test.isValidOffset(OFFSET_0100), false);
assertEquals(test.isValidOffset(OFFSET_0200), true);
assertEquals(test.isValidOffset(OFFSET_0230), false);
assertEquals(test.isValidOffset(OFFSET_0300), true);
assertEquals(test.isValidOffset(OFFSET_0400), false);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_getters_gap.
//-----------------------------------------------------------------------
// getters
//-----------------------------------------------------------------------
@Test
public void test_getters_gap() throws Exception {
LocalDateTime before = LocalDateTime.of(2010, 3, 31, 1, 0);
LocalDateTime after = LocalDateTime.of(2010, 3, 31, 2, 0);
ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0200, OFFSET_0300);
assertEquals(test.isGap(), true);
assertEquals(test.isOverlap(), false);
assertEquals(test.getDateTimeBefore(), before);
assertEquals(test.getDateTimeAfter(), after);
assertEquals(test.getInstant(), before.toInstant(OFFSET_0200));
assertEquals(test.getOffsetBefore(), OFFSET_0200);
assertEquals(test.getOffsetAfter(), OFFSET_0300);
assertEquals(test.getDuration(), Duration.of(1, HOURS));
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransitionRule method test_createTransition_floatingWeekBackwards_seventhLast.
@Test
public void test_createTransition_floatingWeekBackwards_seventhLast() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, -7, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition trans = ZoneOffsetTransition.of(LocalDateTime.of(2000, Month.MARCH, 19, 1, 0), OFFSET_0200, OFFSET_0300);
assertEquals(test.createTransition(2000), trans);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransitionRule method test_createTransition_floatingWeekBackwards_last.
@Test
public void test_createTransition_floatingWeekBackwards_last() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition trans = ZoneOffsetTransition.of(LocalDateTime.of(2000, Month.MARCH, 26, 1, 0), OFFSET_0200, OFFSET_0300);
assertEquals(test.createTransition(2000), trans);
}
Aggregations