use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minusNanos_noChange_equal.
@Test
public void test_minusNanos_noChange_equal() {
LocalTime t = TEST_12_30_40_987654321.minusNanos(0);
assertEquals(t, TEST_12_30_40_987654321);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_withHour_toMidnight_equal.
@Test
public void test_withHour_toMidnight_equal() {
LocalTime t = LocalTime.of(1, 0).withHour(0);
assertEquals(t, LocalTime.MIDNIGHT);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusNanos_fromZero.
@Test(dataProvider = "plusNanos_fromZero")
public void test_plusNanos_fromZero(long nanoseconds, int hour, int min, int sec, int nanos) {
LocalTime base = LocalTime.MIDNIGHT;
LocalTime t = base.plusNanos(nanoseconds);
assertEquals(hour, t.getHour());
assertEquals(min, t.getMinute());
assertEquals(sec, t.getSecond());
assertEquals(nanos, t.getNano());
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_hashCode_nano_differs.
@Test(dataProvider = "sampleTimes")
public void test_hashCode_nano_differs(int h, int m, int s, int n) {
LocalTime a = LocalTime.of(h, m, s, n);
LocalTime b = LocalTime.of(h, m, s, n + 1);
assertEquals(a.hashCode() == b.hashCode(), false);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_with_longTemporalField_minuteOfDay.
// Returns a {@code LocalTime} with the specified minute-of-day.
// The second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_minuteOfDay() {
for (long i : testPoints(24 * 60)) {
LocalTime test = TEST_12_30_40_987654321.with(MINUTE_OF_DAY, i);
assertEquals(test.get(MINUTE_OF_DAY), i);
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