use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneId method test_prefixOfOffset.
@Test(dataProvider = "prefixValid")
public void test_prefixOfOffset(String prefix, String offset) {
ZoneOffset zoff = ZoneOffset.of(offset);
ZoneId zoneId = ZoneId.ofOffset(prefix, zoff);
assertEquals(zoneId.getId(), prefix + zoff.getId(), "in correct id for : " + prefix + ", zoff: " + zoff);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_constant_MAX.
@Test
public void test_constant_MAX() {
ZoneOffset test = ZoneOffset.MAX;
doTestOffset(test, 18, 0, 0);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKZoneOffset method test_toString.
//-----------------------------------------------------------------------
// toString()
//-----------------------------------------------------------------------
@Test
public void test_toString() {
ZoneOffset offset = ZoneOffset.ofHoursMinutesSeconds(1, 0, 0);
assertEquals(offset.toString(), "+01:00");
offset = ZoneOffset.ofHoursMinutesSeconds(1, 2, 3);
assertEquals(offset.toString(), "+01:02:03");
offset = ZoneOffset.UTC;
assertEquals(offset.toString(), "Z");
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_MinguoDate.
@SuppressWarnings("unused")
@Test(dataProvider = "samples")
public void test_MinguoDate(MinguoDate minguoDate, LocalDate iso) {
MinguoDate hd = minguoDate;
ChronoLocalDateTime<MinguoDate> hdt = hd.atTime(LocalTime.NOON);
ZoneOffset zo = ZoneOffset.ofHours(1);
ChronoZonedDateTime<MinguoDate> hzdt = hdt.atZone(zo);
hdt = hdt.plus(1, ChronoUnit.YEARS);
hdt = hdt.plus(1, ChronoUnit.MONTHS);
hdt = hdt.plus(1, ChronoUnit.DAYS);
hdt = hdt.plus(1, ChronoUnit.HOURS);
hdt = hdt.plus(1, ChronoUnit.MINUTES);
hdt = hdt.plus(1, ChronoUnit.SECONDS);
hdt = hdt.plus(1, ChronoUnit.NANOS);
ChronoLocalDateTime<MinguoDate> a2 = hzdt.toLocalDateTime();
MinguoDate a3 = a2.toLocalDate();
MinguoDate a5 = hzdt.toLocalDate();
//System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
}
use of java.time.ZoneOffset in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatterBuilder method test_appendOffset_format.
@Test(dataProvider = "offsetPatterns")
public void test_appendOffset_format(String pattern, int h, int m, int s, String expected) throws Exception {
builder.appendOffset(pattern, "Z");
DateTimeFormatter f = builder.toFormatter();
ZoneOffset offset = ZoneOffset.ofHoursMinutesSeconds(h, m, s);
assertEquals(f.format(offset), expected);
}
Aggregations