use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_withHour_normal.
//-----------------------------------------------------------------------
// withHour()
//-----------------------------------------------------------------------
@Test
public void test_withHour_normal() {
OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
OffsetTime test = base.withHour(15);
assertEquals(test, OffsetTime.of(15, 30, 59, 0, OFFSET_PONE));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_minus_MinusAdjuster.
//-----------------------------------------------------------------------
// minus(MinusAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_minus_MinusAdjuster() {
MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MINUTES);
OffsetTime t = TEST_11_30_59_500_PONE.minus(period);
assertEquals(t, OffsetTime.of(11, 23, 59, 500, OFFSET_PONE));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method factory_parse_validText.
//-----------------------------------------------------------------------
// parse()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleToString")
public void factory_parse_validText(int h, int m, int s, int n, String offsetId, String parsable) {
OffsetTime t = OffsetTime.parse(parsable);
assertNotNull(t, parsable);
check(t, h, m, s, n, ZoneOffset.of(offsetId));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_get_TemporalField.
//-----------------------------------------------------------------------
// get(TemporalField)
//-----------------------------------------------------------------------
@Test
public void test_get_TemporalField() {
OffsetTime test = OffsetTime.of(12, 30, 40, 987654321, OFFSET_PONE);
assertEquals(test.get(ChronoField.HOUR_OF_DAY), 12);
assertEquals(test.get(ChronoField.MINUTE_OF_HOUR), 30);
assertEquals(test.get(ChronoField.SECOND_OF_MINUTE), 40);
assertEquals(test.get(ChronoField.NANO_OF_SECOND), 987654321);
assertEquals(test.get(ChronoField.HOUR_OF_AMPM), 0);
assertEquals(test.get(ChronoField.AMPM_OF_DAY), 1);
assertEquals(test.get(ChronoField.OFFSET_SECONDS), 3600);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_compareTo_time.
//-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
public void test_compareTo_time() {
OffsetTime a = OffsetTime.of(11, 29, 0, 0, OFFSET_PONE);
// a is before b due to time
OffsetTime b = OffsetTime.of(11, 30, 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);
}
Aggregations