use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoLocalDateTime_noOverrideChrono_matches.
//-------------------------------------------------------------------------
@Test
public void test_fieldResolvesToChronoLocalDateTime_noOverrideChrono_matches() {
LocalDateTime ldt = LocalDateTime.of(2010, 6, 30, 12, 30);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(ldt)).toFormatter();
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(2010, 6, 30));
assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(12, 30));
assertEquals(accessor.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestLocalDateTime method test_minusMonths_int_noChange.
@Test
public void test_minusMonths_int_noChange() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusMonths(0);
assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestLocalDateTime method test_withYear_int_noChange.
@Test
public void test_withYear_int_noChange() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withYear(2007);
assertSame(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate());
assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestLocalDateTime method test_withSecond_toMidnight.
@Test
public void test_withSecond_toMidnight() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 1)).withSecond(0);
assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TestLocalDateTime method test_withMonth_int_noChange.
@Test
public void test_withMonth_int_noChange() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonth(7);
assertSame(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate());
assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
}
Aggregations