use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_minus_long_TemporalUnit.
@Test(dataProvider = "minus_long_TemporalUnit")
public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class<?> expectedEx) {
if (expectedEx == null) {
assertEquals(base.minus(amount, unit), expectedYear);
} else {
try {
Year result = base.minus(amount, unit);
fail();
} catch (Exception ex) {
assertTrue(expectedEx.isInstance(ex));
}
}
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_with_BadTemporalAdjuster.
@Test(expectedExceptions = DateTimeException.class)
public void test_with_BadTemporalAdjuster() {
Year test = Year.of(1);
test.with(LocalTime.of(18, 1, 2));
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_equals_nullYear.
@Test
public void test_equals_nullYear() {
Year doy = null;
Year test = Year.of(1);
assertEquals(test.equals(doy), false);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_atDay_leapYear.
@Test
public void test_atDay_leapYear() {
Year test = Year.of(2008);
LocalDate expected = LocalDate.of(2008, 1, 1);
for (int i = 1; i <= 366; i++) {
assertEquals(test.atDay(i), expected);
expected = expected.plusDays(1);
}
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method factory_parse_success.
@Test(dataProvider = "goodParseData")
public void factory_parse_success(String text, Year expected) {
Year year = Year.parse(text);
assertEquals(year, expected);
}
Aggregations