use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TestLocalTime method factory_time_4ints_singletons.
@Test
public void factory_time_4ints_singletons() {
for (int i = 0; i < 24; i++) {
LocalTime test1 = LocalTime.of(i, 0, 0, 0);
LocalTime test2 = LocalTime.of(i, 0, 0, 0);
assertSame(test1, test2);
}
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TestLocalTime method factory_ofSecondOfDay_singletons.
@Test
public void factory_ofSecondOfDay_singletons() {
for (int i = 0; i < 24; i++) {
LocalTime test1 = LocalTime.ofSecondOfDay(i * 60L * 60L);
LocalTime test2 = LocalTime.of(i, 0);
assertSame(test1, test2);
}
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_comparisons_LocalDateTime.
void test_comparisons_LocalDateTime(LocalDate[] localDates, LocalTime... localTimes) {
LocalDateTime[] localDateTimes = new LocalDateTime[localDates.length * localTimes.length];
int i = 0;
for (LocalDate localDate : localDates) {
for (LocalTime localTime : localTimes) {
localDateTimes[i++] = LocalDateTime.of(localDate, localTime);
}
}
doTest_comparisons_LocalDateTime(localDateTimes);
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_minusMinutes_fromZero.
@Test
public void test_minusMinutes_fromZero() {
LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.MIDNIGHT);
LocalDate d = base.toLocalDate().minusDays(1);
LocalTime t = LocalTime.of(22, 49);
for (int i = 70; i > -70; i--) {
LocalDateTime dt = base.minusMinutes(i);
t = t.plusMinutes(1);
if (t.equals(LocalTime.MIDNIGHT)) {
d = d.plusDays(1);
}
assertEquals(dt.toLocalDate(), d);
assertEquals(dt.toLocalTime(), t);
}
}
use of java.time.LocalTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method factory_LocalTimeZoneOffset.
//-----------------------------------------------------------------------
@Test
public void factory_LocalTimeZoneOffset() {
LocalTime localTime = LocalTime.of(11, 30, 10, 500);
OffsetTime test = OffsetTime.of(localTime, OFFSET_PONE);
check(test, 11, 30, 10, 500, OFFSET_PONE);
}
Aggregations