use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method factory_parse_formatter.
//-----------------------------------------------------------------------
// parse(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void factory_parse_formatter() {
DateTimeFormatter f = DateTimeFormatter.ofPattern("H m s XXX");
OffsetTime test = OffsetTime.parse("11 30 0 +01:00", f);
assertEquals(test, OffsetTime.of(11, 30, 0, 0, ZoneOffset.ofHours(1)));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_getLong_TemporalField.
@Test
public void test_getLong_TemporalField() {
OffsetTime test = OffsetTime.of(12, 30, 40, 987654321, OFFSET_PONE);
assertEquals(test.getLong(ChronoField.HOUR_OF_DAY), 12);
assertEquals(test.getLong(ChronoField.MINUTE_OF_HOUR), 30);
assertEquals(test.getLong(ChronoField.SECOND_OF_MINUTE), 40);
assertEquals(test.getLong(ChronoField.NANO_OF_SECOND), 987654321);
assertEquals(test.getLong(ChronoField.HOUR_OF_AMPM), 0);
assertEquals(test.getLong(ChronoField.AMPM_OF_DAY), 1);
assertEquals(test.getLong(ChronoField.OFFSET_SECONDS), 3600);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_with_adjustment_AmPm.
@Test
public void test_with_adjustment_AmPm() {
OffsetTime test = TEST_11_30_59_500_PONE.with(new TemporalAdjuster() {
@Override
public Temporal adjustInto(Temporal dateTime) {
return dateTime.with(HOUR_OF_DAY, 23);
}
});
assertEquals(test, OffsetTime.of(23, 30, 59, 500, OFFSET_PONE));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_compareTo_both.
@Test
public void test_compareTo_both() {
OffsetTime a = OffsetTime.of(11, 50, 0, 0, OFFSET_PTWO);
// a is before b on instant scale
OffsetTime b = OffsetTime.of(11, 20, 0, 0, OFFSET_PONE);
assertEquals(a.compareTo(b) < 0, true);
assertEquals(b.compareTo(a) > 0, true);
assertEquals(a.compareTo(a) == 0, true);
assertEquals(b.compareTo(b) == 0, true);
assertEquals(convertInstant(a).compareTo(convertInstant(b)) < 0, true);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_plusHours_zero.
@Test
public void test_plusHours_zero() {
OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
OffsetTime test = base.plusHours(0);
assertEquals(test, base);
}
Aggregations