use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_toString.
@Test(dataProvider = "sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
LocalTime t = LocalTime.of(h, m, s, n);
String str = t.toString();
assertEquals(str, expected);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_atOffset.
//-----------------------------------------------------------------------
// atOffset()
//-----------------------------------------------------------------------
@Test
public void test_atOffset() {
LocalTime t = LocalTime.of(11, 30);
assertEquals(t.atOffset(OFFSET_PTWO), OffsetTime.of(LocalTime.of(11, 30), OFFSET_PTWO));
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusHours_big.
@Test
public void test_plusHours_big() {
LocalTime t = LocalTime.of(2, 30).plusHours(Long.MAX_VALUE);
int hours = (int) (Long.MAX_VALUE % 24L);
assertEquals(t, LocalTime.of(2, 30).plusHours(hours));
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_withNanoOfSecond_toMidday_equal.
@Test
public void test_withNanoOfSecond_toMidday_equal() {
LocalTime t = LocalTime.of(12, 0, 0, 1).withNano(0);
assertEquals(t, LocalTime.NOON);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_with_longTemporalField_hourOfAmPm.
// Returns a {@code LocalTime} with the specified hour-of-am-pm.
// The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_hourOfAmPm() {
for (int i = 0; i < 12; i++) {
LocalTime test = TEST_12_30_40_987654321.with(HOUR_OF_AMPM, i);
assertEquals(test.get(HOUR_OF_AMPM), i);
assertEquals(test.get(AMPM_OF_DAY), TEST_12_30_40_987654321.get(AMPM_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
Aggregations