use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_getRules.
//-----------------------------------------------------------------------
// getRules()
//-----------------------------------------------------------------------
@Test
public void test_getRules() {
ZoneOffset offset = ZoneOffset.ofHoursMinutesSeconds(1, 2, 3);
assertEquals(offset.getRules().isFixedOffset(), true);
assertEquals(offset.getRules().getOffset((Instant) null), offset);
assertEquals(offset.getRules().getDaylightSavings((Instant) null), Duration.ZERO);
assertEquals(offset.getRules().getStandardOffset((Instant) null), offset);
assertEquals(offset.getRules().nextTransition((Instant) null), null);
assertEquals(offset.getRules().previousTransition((Instant) null), null);
assertEquals(offset.getRules().isValidOffset((LocalDateTime) null, offset), true);
assertEquals(offset.getRules().isValidOffset((LocalDateTime) null, ZoneOffset.UTC), false);
assertEquals(offset.getRules().isValidOffset((LocalDateTime) null, null), false);
assertEquals(offset.getRules().getOffset((LocalDateTime) null), offset);
assertEquals(offset.getRules().getValidOffsets((LocalDateTime) null), Arrays.asList(offset));
assertEquals(offset.getRules().getTransition((LocalDateTime) null), null);
assertEquals(offset.getRules().getTransitions().size(), 0);
assertEquals(offset.getRules().getTransitionRules().size(), 0);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_factory_string_UTC.
//-----------------------------------------------------------------------
// of(String)
//-----------------------------------------------------------------------
@Test
public void test_factory_string_UTC() {
String[] values = new String[] { "Z", "+0", "+00", "+0000", "+00:00", "+000000", "+00:00:00", "-00", "-0000", "-00:00", "-000000", "-00:00:00" };
for (int i = 0; i < values.length; i++) {
ZoneOffset test = ZoneOffset.of(values[i]);
assertSame(test, ZoneOffset.UTC);
}
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneId method test_invalidPrefixOfOffset.
@Test(dataProvider = "prefixInvalid", expectedExceptions = java.lang.IllegalArgumentException.class)
public void test_invalidPrefixOfOffset(String prefix, String offset) {
ZoneOffset zoff = ZoneOffset.of(offset);
ZoneId zoneId = ZoneId.ofOffset(prefix, zoff);
fail("should have thrown an exception for prefix: " + prefix);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_compareTo.
//-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
public void test_compareTo() {
ZoneOffset offset1 = ZoneOffset.ofHoursMinutesSeconds(1, 2, 3);
ZoneOffset offset2 = ZoneOffset.ofHoursMinutesSeconds(2, 3, 4);
assertTrue(offset1.compareTo(offset2) > 0);
assertTrue(offset2.compareTo(offset1) < 0);
assertTrue(offset1.compareTo(offset1) == 0);
assertTrue(offset2.compareTo(offset2) == 0);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_constant_MIN.
@Test
public void test_constant_MIN() {
ZoneOffset test = ZoneOffset.MIN;
doTestOffset(test, -18, 0, 0);
}
Aggregations