use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusMonths_long_invalidTooLarge.
@Test(expectedExceptions = { DateTimeException.class })
public void test_minusMonths_long_invalidTooLarge() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.minusMonths(-1);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_withYear.
//-----------------------------------------------------------------------
// withYear()
//-----------------------------------------------------------------------
@Test
public void test_withYear() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.withYear(1999), YearMonth.of(1999, 6));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minus_TemporalAmount.
@Test(dataProvider = "minus_TemporalAmount")
public void test_minus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class<?> expectedEx) {
if (expectedEx == null) {
assertEquals(base.minus(temporalAmount), expectedYearMonth);
} else {
try {
YearMonth result = base.minus(temporalAmount);
fail();
} catch (Exception ex) {
assertTrue(expectedEx.isInstance(ex));
}
}
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_lengthOfMonth_febLeap.
@Test
public void test_lengthOfMonth_febLeap() {
YearMonth test = YearMonth.of(2008, 2);
assertEquals(test.lengthOfMonth(), 29);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_invalidTooLargeMaxAddMax.
@Test(expectedExceptions = DateTimeException.class)
public void test_plusYears_long_invalidTooLargeMaxAddMax() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.plusYears(Long.MAX_VALUE);
}
Aggregations