use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method now_Clock.
//-----------------------------------------------------------------------
// now(Clock)
//-----------------------------------------------------------------------
@Test
public void now_Clock() {
Instant instant = OffsetDateTime.of(LocalDate.of(2010, 12, 31), LocalTime.of(0, 0), ZoneOffset.UTC).toInstant();
Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
Year test = Year.now(clock);
assertEquals(test.getValue(), 2010);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_compareTo_nullYear.
@Test(expectedExceptions = NullPointerException.class)
public void test_compareTo_nullYear() {
Year doy = null;
Year test = Year.of(1);
test.compareTo(doy);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_adjustDate_resolve.
@Test
public void test_adjustDate_resolve() {
Year test = Year.of(2011);
assertEquals(test.adjustInto(LocalDate.of(2012, 2, 29)), LocalDate.of(2011, 2, 28));
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_atMonthDay_nullMonthDay.
@Test(expectedExceptions = NullPointerException.class)
public void test_atMonthDay_nullMonthDay() {
Year test = Year.of(2008);
test.atMonthDay((MonthDay) null);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_atDay_notLeapYear.
//-----------------------------------------------------------------------
// atDay(int)
//-----------------------------------------------------------------------
@Test
public void test_atDay_notLeapYear() {
Year test = Year.of(2007);
LocalDate expected = LocalDate.of(2007, 1, 1);
for (int i = 1; i <= 365; i++) {
assertEquals(test.atDay(i), expected);
expected = expected.plusDays(1);
}
}
Aggregations