use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_NewYork_getOffset_fromDST.
public void test_NewYork_getOffset_fromDST() {
ZoneRules test = americaNewYork();
ZoneOffset offset = ZoneOffset.ofHours(-4);
assertEquals(test.getOffset(createInstant(2008, 11, 1, offset)), ZoneOffset.ofHours(-4));
assertEquals(test.getOffset(createInstant(2008, 11, 2, offset)), ZoneOffset.ofHours(-4));
assertEquals(test.getOffset(createInstant(2008, 11, 3, offset)), ZoneOffset.ofHours(-5));
assertEquals(test.getOffset(createInstant(2008, 11, 4, offset)), ZoneOffset.ofHours(-5));
assertEquals(test.getOffset(createInstant(2008, 11, 5, offset)), ZoneOffset.ofHours(-5));
assertEquals(test.getOffset(createInstant(2008, 11, 6, offset)), ZoneOffset.ofHours(-5));
assertEquals(test.getOffset(createInstant(2008, 11, 7, offset)), ZoneOffset.ofHours(-5));
// cutover at 02:00 local
assertEquals(test.getOffset(createInstant(2008, 11, 2, 1, 59, 59, 999999999, offset)), ZoneOffset.ofHours(-4));
assertEquals(test.getOffset(createInstant(2008, 11, 2, 2, 0, 0, 0, offset)), ZoneOffset.ofHours(-5));
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_Kathmandu_nextTransition_noRules.
public void test_Kathmandu_nextTransition_noRules() {
ZoneRules test = asiaKathmandu();
List<ZoneOffsetTransition> trans = test.getTransitions();
ZoneOffsetTransition last = trans.get(trans.size() - 1);
assertEquals(test.nextTransition(last.getInstant()), null);
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKZoneRules method test_London_nextTransition_historic.
//-----------------------------------------------------------------------
public void test_London_nextTransition_historic() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransition> trans = test.getTransitions();
ZoneOffsetTransition first = trans.get(0);
assertEquals(test.nextTransition(first.getInstant().minusNanos(1)), first);
for (int i = 0; i < trans.size() - 1; i++) {
ZoneOffsetTransition cur = trans.get(i);
ZoneOffsetTransition next = trans.get(i + 1);
assertEquals(test.nextTransition(cur.getInstant()), next);
assertEquals(test.nextTransition(next.getInstant().minusNanos(1)), next);
}
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKFixedZoneRules method test_getTransitions_immutable.
@Test(expectedExceptions = UnsupportedOperationException.class)
public void test_getTransitions_immutable() {
ZoneRules test = make(OFFSET_PTWO);
test.getTransitions().add(ZoneOffsetTransition.of(LDT, OFFSET_PONE, OFFSET_PTWO));
}
use of java.time.zone.ZoneRules in project jdk8u_jdk by JetBrains.
the class TCKFixedZoneRules method test_equalsHashCode.
//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
@Test
public void test_equalsHashCode() {
ZoneRules a = make(OFFSET_PONE);
ZoneRules b = make(OFFSET_PTWO);
assertEquals(a.equals(a), true);
assertEquals(a.equals(b), false);
assertEquals(b.equals(a), false);
assertEquals(b.equals(b), true);
assertEquals(a.equals("Rubbish"), false);
assertEquals(a.equals(null), false);
assertEquals(a.hashCode() == a.hashCode(), true);
assertEquals(b.hashCode() == b.hashCode(), true);
}
Aggregations