use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_noChange_equal.
@Test
public void test_plusYears_long_noChange_equal() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.plusYears(0), test);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusMonths_long_overYears.
@Test
public void test_minusMonths_long_overYears() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.minusMonths(6), YearMonth.of(2007, 12));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_invalidTooSmall.
@Test(expectedExceptions = DateTimeException.class)
public void test_plusYears_long_invalidTooSmall() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 6);
test.plusYears(-1);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_big.
@Test
public void test_plusYears_long_big() {
YearMonth test = YearMonth.of(-40, 6);
assertEquals(test.plusYears(20L + Year.MAX_VALUE), YearMonth.of((int) (-40L + 20L + Year.MAX_VALUE), 6));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method doTest_comparisons_YearMonth.
void doTest_comparisons_YearMonth(YearMonth... localDates) {
for (int i = 0; i < localDates.length; i++) {
YearMonth a = localDates[i];
for (int j = 0; j < localDates.length; j++) {
YearMonth b = localDates[j];
if (i < j) {
assertTrue(a.compareTo(b) < 0, a + " <=> " + b);
assertEquals(a.isBefore(b), true, a + " <=> " + b);
assertEquals(a.isAfter(b), false, a + " <=> " + b);
assertEquals(a.equals(b), false, a + " <=> " + b);
} else if (i > j) {
assertTrue(a.compareTo(b) > 0, a + " <=> " + b);
assertEquals(a.isBefore(b), false, a + " <=> " + b);
assertEquals(a.isAfter(b), true, a + " <=> " + b);
assertEquals(a.equals(b), false, a + " <=> " + b);
} else {
assertEquals(a.compareTo(b), 0, a + " <=> " + b);
assertEquals(a.isBefore(b), false, a + " <=> " + b);
assertEquals(a.isAfter(b), false, a + " <=> " + b);
assertEquals(a.equals(b), true, a + " <=> " + b);
}
}
}
}
Aggregations