use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusHours_toMidnight_equal.
@Test
public void test_plusHours_toMidnight_equal() {
LocalTime t = LocalTime.of(23, 0).plusHours(1);
assertEquals(t, LocalTime.MIDNIGHT);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minusHours_noChange_equal.
@Test
public void test_minusHours_noChange_equal() {
LocalTime t = TEST_12_30_40_987654321.minusHours(0);
assertEquals(t, TEST_12_30_40_987654321);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minusHours_fromZero.
@Test
public void test_minusHours_fromZero() {
LocalTime base = LocalTime.MIDNIGHT;
for (int i = -50; i < 50; i++) {
LocalTime t = base.minusHours(i);
assertEquals(t.getHour(), ((-i % 24) + 24) % 24);
}
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusHours_fromOne.
@Test
public void test_plusHours_fromOne() {
LocalTime base = LocalTime.of(1, 0);
for (int i = -50; i < 50; i++) {
LocalTime t = base.plusHours(i);
assertEquals(t.getHour(), (1 + i + 72) % 24);
}
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minusHours_one.
//-----------------------------------------------------------------------
// minusHours()
//-----------------------------------------------------------------------
@Test
public void test_minusHours_one() {
LocalTime t = LocalTime.MIDNIGHT;
for (int i = 0; i < 50; i++) {
t = t.minusHours(1);
assertEquals(t.getHour(), (((-i + 23) % 24) + 24) % 24, String.valueOf(i));
}
}
Aggregations