use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_NewYork_getOffsetInfo_gap.
public void test_NewYork_getOffsetInfo_gap() {
ZoneRules test = americaNewYork();
final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 9, 2, 0, 0, 0);
ZoneOffsetTransition trans = checkOffset(test, dateTime, ZoneOffset.ofHours(-5), GAP);
assertEquals(trans.isGap(), true);
assertEquals(trans.isOverlap(), false);
assertEquals(trans.getOffsetBefore(), ZoneOffset.ofHours(-5));
assertEquals(trans.getOffsetAfter(), ZoneOffset.ofHours(-4));
assertEquals(trans.getInstant(), createInstant(2008, 3, 9, 2, 0, ZoneOffset.ofHours(-5)));
assertEquals(trans.isValidOffset(OFFSET_PTWO), false);
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-5)), false);
assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-4)), 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.getTransition(dateTime);
assertTrue(trans.equals(otherTrans));
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_NewYork_getOffsetInfo.
public void test_NewYork_getOffsetInfo() {
ZoneRules test = americaNewYork();
checkOffset(test, createLDT(2008, 1, 1), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 2, 1), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 3, 1), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 4, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 5, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 6, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 7, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 8, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 9, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 10, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 11, 1), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 12, 1), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 1, 28), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 2, 28), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 3, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 4, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 5, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 6, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 7, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 8, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 9, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 10, 28), ZoneOffset.ofHours(-4), 1);
checkOffset(test, createLDT(2008, 11, 28), ZoneOffset.ofHours(-5), 1);
checkOffset(test, createLDT(2008, 12, 28), ZoneOffset.ofHours(-5), 1);
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_NewYork.
public void test_NewYork() {
ZoneRules test = americaNewYork();
assertEquals(test.isFixedOffset(), false);
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_London_previousTransition_historic.
//-----------------------------------------------------------------------
public void test_London_previousTransition_historic() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransition> trans = test.getTransitions();
ZoneOffsetTransition first = trans.get(0);
assertEquals(test.previousTransition(first.getInstant()), null);
assertEquals(test.previousTransition(first.getInstant().minusNanos(1)), null);
for (int i = 0; i < trans.size() - 1; i++) {
ZoneOffsetTransition prev = trans.get(i);
ZoneOffsetTransition cur = trans.get(i + 1);
assertEquals(test.previousTransition(cur.getInstant()), prev);
assertEquals(test.previousTransition(prev.getInstant().plusSeconds(1)), prev);
assertEquals(test.previousTransition(prev.getInstant().plusNanos(1)), prev);
}
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_Paris_getOffset_fromDST.
public void test_Paris_getOffset_fromDST() {
ZoneRules test = europeParis();
assertEquals(test.getOffset(createInstant(2008, 10, 24, ZoneOffset.UTC)), OFFSET_PTWO);
assertEquals(test.getOffset(createInstant(2008, 10, 25, ZoneOffset.UTC)), OFFSET_PTWO);
assertEquals(test.getOffset(createInstant(2008, 10, 26, ZoneOffset.UTC)), OFFSET_PTWO);
assertEquals(test.getOffset(createInstant(2008, 10, 27, ZoneOffset.UTC)), OFFSET_PONE);
assertEquals(test.getOffset(createInstant(2008, 10, 28, ZoneOffset.UTC)), OFFSET_PONE);
assertEquals(test.getOffset(createInstant(2008, 10, 29, ZoneOffset.UTC)), OFFSET_PONE);
assertEquals(test.getOffset(createInstant(2008, 10, 30, ZoneOffset.UTC)), OFFSET_PONE);
assertEquals(test.getOffset(createInstant(2008, 10, 31, ZoneOffset.UTC)), OFFSET_PONE);
// cutover at 01:00Z
assertEquals(test.getOffset(createInstant(2008, 10, 26, 0, 59, 59, 999999999, ZoneOffset.UTC)), OFFSET_PTWO);
assertEquals(test.getOffset(createInstant(2008, 10, 26, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PONE);
}
Aggregations