use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_withSecond_toMidnight_equal.
@Test
public void test_withSecond_toMidnight_equal() {
LocalTime t = LocalTime.of(0, 0, 1).withSecond(0);
assertEquals(t, LocalTime.MIDNIGHT);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusNanos_toMidday_equal.
@Test
public void test_plusNanos_toMidday_equal() {
LocalTime t = LocalTime.of(11, 59, 59, 999999999).plusNanos(1);
assertEquals(t, LocalTime.NOON);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plusMinutes_noChange_equal.
@Test
public void test_plusMinutes_noChange_equal() {
LocalTime t = TEST_12_30_40_987654321.plusMinutes(0);
assertEquals(t, TEST_12_30_40_987654321);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minusMinutes_toMidnight_equal.
@Test
public void test_minusMinutes_toMidnight_equal() {
LocalTime t = LocalTime.of(0, 1).minusMinutes(1);
assertEquals(t, LocalTime.MIDNIGHT);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_get.
@Test(dataProvider = "sampleTimes")
public void test_get(int y, int o, int d, int h, int m, int s, int n, ZoneId zone) {
LocalDate localDate = LocalDate.of(y, o, d);
LocalTime localTime = LocalTime.of(h, m, s, n);
LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime);
ZoneOffset offset = zone.getRules().getOffset(localDateTime);
ZonedDateTime a = ZonedDateTime.of(localDateTime, zone);
assertEquals(a.getYear(), localDate.getYear());
assertEquals(a.getMonth(), localDate.getMonth());
assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth());
assertEquals(a.getDayOfYear(), localDate.getDayOfYear());
assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek());
assertEquals(a.getHour(), localTime.getHour());
assertEquals(a.getMinute(), localTime.getMinute());
assertEquals(a.getSecond(), localTime.getSecond());
assertEquals(a.getNano(), localTime.getNano());
assertEquals(a.toLocalDate(), localDate);
assertEquals(a.toLocalTime(), localTime);
assertEquals(a.toLocalDateTime(), localDateTime);
if (zone instanceof ZoneOffset) {
assertEquals(a.toString(), localDateTime.toString() + offset.toString());
} else {
assertEquals(a.toString(), localDateTime.toString() + offset.toString() + "[" + zone.toString() + "]");
}
}
Aggregations