use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_equals.
//-----------------------------------------------------------------------
// equals()
//-----------------------------------------------------------------------
@Test
public void test_equals() {
LocalDateTime ldtA = LocalDateTime.of(2010, 3, 31, 1, 0);
ZoneOffsetTransition a1 = ZoneOffsetTransition.of(ldtA, OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition a2 = ZoneOffsetTransition.of(ldtA, OFFSET_0200, OFFSET_0300);
LocalDateTime ldtB = LocalDateTime.of(2010, 10, 31, 1, 0);
ZoneOffsetTransition b = ZoneOffsetTransition.of(ldtB, OFFSET_0300, OFFSET_0200);
assertEquals(a1.equals(a1), true);
assertEquals(a1.equals(a2), true);
assertEquals(a1.equals(b), false);
assertEquals(a2.equals(a1), true);
assertEquals(a2.equals(a2), true);
assertEquals(a2.equals(b), false);
assertEquals(b.equals(a1), false);
assertEquals(b.equals(a2), false);
assertEquals(b.equals(b), true);
assertEquals(a1.equals(""), false);
assertEquals(a1.equals(null), false);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_isValidOffset_gap.
//-----------------------------------------------------------------------
// isValidOffset()
//-----------------------------------------------------------------------
@Test
public void test_isValidOffset_gap() {
LocalDateTime ldt = LocalDateTime.of(2010, 3, 31, 1, 0);
ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, OFFSET_0200, OFFSET_0300);
assertEquals(test.isValidOffset(OFFSET_0100), false);
assertEquals(test.isValidOffset(OFFSET_0200), false);
assertEquals(test.isValidOffset(OFFSET_0230), false);
assertEquals(test.isValidOffset(OFFSET_0300), false);
assertEquals(test.isValidOffset(OFFSET_0400), false);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_toString_gap.
//-----------------------------------------------------------------------
// toString()
//-----------------------------------------------------------------------
@Test
public void test_toString_gap() {
LocalDateTime ldt = LocalDateTime.of(2010, 3, 31, 1, 0);
ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, OFFSET_0200, OFFSET_0300);
assertEquals(test.toString(), "Transition[Gap at 2010-03-31T01:00+02:00 to +03:00]");
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransition method test_compareTo.
//-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
public void test_compareTo() {
ZoneOffsetTransition a = ZoneOffsetTransition.of(LocalDateTime.ofEpochSecond(23875287L - 1, 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 + 1, 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_getters_overlap.
@Test
public void test_getters_overlap() throws Exception {
LocalDateTime before = LocalDateTime.of(2010, 10, 31, 1, 0);
LocalDateTime after = LocalDateTime.of(2010, 10, 31, 0, 0);
ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0300, OFFSET_0200);
assertEquals(test.isGap(), false);
assertEquals(test.isOverlap(), true);
assertEquals(test.getDateTimeBefore(), before);
assertEquals(test.getDateTimeAfter(), after);
assertEquals(test.getInstant(), before.toInstant(OFFSET_0300));
assertEquals(test.getOffsetBefore(), OFFSET_0300);
assertEquals(test.getOffsetAfter(), OFFSET_0200);
assertEquals(test.getDuration(), Duration.of(-1, HOURS));
}
Aggregations