use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransitionRule method test_createTransition_floatingWeek_gap_notEndOfDay.
//-----------------------------------------------------------------------
// createTransition()
//-----------------------------------------------------------------------
@Test
public void test_createTransition_floatingWeek_gap_notEndOfDay() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, 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);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransitionRule method test_createTransition_fixedDate.
@Test
public void test_createTransition_fixedDate() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD, OFFSET_0200, OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition trans = ZoneOffsetTransition.of(LocalDateTime.of(2000, Month.MARCH, 20, 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 TCKZoneOffsetTransitionSerialization method test_serialization_unusual2.
@Test
public void test_serialization_unusual2() throws Exception {
LocalDateTime ldt = LocalDateTime.of(Year.MIN_VALUE, 1, 1, 12, 1, 3);
ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("+10:02:34"));
assertSerializable(test);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TCKZoneOffsetTransitionSerialization method test_serialization_gap.
@Test
public void test_serialization_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);
assertSerializable(test);
}
use of java.time.zone.ZoneOffsetTransition in project jdk8u_jdk by JetBrains.
the class TestZoneId method test_NewYork_getOffsetInfo_gap.
public void test_NewYork_getOffsetInfo_gap() {
ZoneId test = ZoneId.of("America/New_York");
final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 9, 2, 0, 0, 0);
ZoneOffsetTransition trans = checkOffset(test.getRules(), dateTime, ZoneOffset.ofHours(-5), GAP);
assertEquals(trans.getOffsetBefore(), ZoneOffset.ofHours(-5));
assertEquals(trans.getOffsetAfter(), ZoneOffset.ofHours(-4));
assertEquals(trans.getInstant(), createInstant(2008, 3, 9, 2, 0, 0, 0, ZoneOffset.ofHours(-5)));
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-6)), false);
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-5)), false);
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-4)), false);
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-3)), false);
assertEquals(trans.toString(), "Transition[Gap at 2008-03-09T02:00-05:00 to -04:00]");
assertFalse(trans.equals(null));
assertFalse(trans.equals(ZoneOffset.ofHours(-5)));
assertTrue(trans.equals(trans));
final ZoneOffsetTransition otherTrans = test.getRules().getTransition(dateTime);
assertTrue(trans.equals(otherTrans));
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
Aggregations