use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestChronoLocalDate method test_date_checkGenerics_chronoLocalDateTime1.
public void test_date_checkGenerics_chronoLocalDateTime1() {
LocalDateTime now = LocalDateTime.now();
Chronology chrono = ThaiBuddhistChronology.INSTANCE;
ChronoLocalDateTime<?> ldt = chrono.localDateTime(now);
ldt = processCLDT(ldt);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method test_LocalDateTime_adjustToHijrahDate.
// Test to get the local date time by applying the MIN adjustment with hijrah date
@Test(dataProvider = "samples")
public void test_LocalDateTime_adjustToHijrahDate(ChronoLocalDate hijrahDate, LocalDate localDate) {
LocalDateTime test = LocalDateTime.MIN.with(hijrahDate);
assertEquals(test, LocalDateTime.of(localDate, LocalTime.MIDNIGHT));
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestChronoLocalDate method test_date_checkGenerics_chronoLocalDateTime2.
public void test_date_checkGenerics_chronoLocalDateTime2() {
LocalDateTime now = LocalDateTime.now();
Chronology chrono = ThaiBuddhistChronology.INSTANCE;
ChronoLocalDateTime<? extends ChronoLocalDate> ldt = chrono.localDateTime(now);
ldt = processCLDT(ldt);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_until_convertedType.
@Test
public void test_until_convertedType() {
LocalTime start = LocalTime.of(11, 30);
LocalDateTime end = start.plusSeconds(2).atDate(LocalDate.of(2010, 6, 30));
assertEquals(start.until(end, SECONDS), 2);
}
use of java.time.LocalDateTime 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