use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_invalidTooLargeMaxAddMin.
@Test(expectedExceptions = DateTimeException.class)
public void test_plusYears_long_invalidTooLargeMaxAddMin() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.plusYears(Long.MIN_VALUE);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plus_long_TemporalUnit.
@Test(dataProvider = "plus_long_TemporalUnit")
public void test_plus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class<?> expectedEx) {
if (expectedEx == null) {
assertEquals(base.plus(amount, unit), expectedYearMonth);
} else {
try {
YearMonth result = base.plus(amount, unit);
fail();
} catch (Exception ex) {
assertTrue(expectedEx.isInstance(ex));
}
}
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusYears_long_invalidTooLarge.
@Test(expectedExceptions = DateTimeException.class)
public void test_minusYears_long_invalidTooLarge() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 6);
test.minusYears(-1);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusMonths_long_invalidTooSmall.
@Test(expectedExceptions = { DateTimeException.class })
public void test_plusMonths_long_invalidTooSmall() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 1);
test.plusMonths(-1);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long.
//-----------------------------------------------------------------------
// plusYears()
//-----------------------------------------------------------------------
@Test
public void test_plusYears_long() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.plusYears(1), YearMonth.of(2009, 6));
}
Aggregations