use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method doTest_comparisons_MonthDay.
void doTest_comparisons_MonthDay(MonthDay... localDates) {
for (int i = 0; i < localDates.length; i++) {
MonthDay a = localDates[i];
for (int j = 0; j < localDates.length; j++) {
MonthDay 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);
}
}
}
}
use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method factory_parse_success.
@Test(dataProvider = "goodParseData")
public void factory_parse_success(String text, MonthDay expected) {
MonthDay monthDay = MonthDay.parse(text);
assertEquals(monthDay, expected);
}
use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method test_equals.
//-----------------------------------------------------------------------
// equals()
//-----------------------------------------------------------------------
@Test
public void test_equals() {
MonthDay a = MonthDay.of(1, 1);
MonthDay b = MonthDay.of(1, 1);
MonthDay c = MonthDay.of(2, 1);
MonthDay d = MonthDay.of(1, 2);
assertEquals(a.equals(a), true);
assertEquals(a.equals(b), true);
assertEquals(a.equals(c), false);
assertEquals(a.equals(d), false);
assertEquals(b.equals(a), true);
assertEquals(b.equals(b), true);
assertEquals(b.equals(c), false);
assertEquals(b.equals(d), false);
assertEquals(c.equals(a), false);
assertEquals(c.equals(b), false);
assertEquals(c.equals(c), true);
assertEquals(c.equals(d), false);
assertEquals(d.equals(a), false);
assertEquals(d.equals(b), false);
assertEquals(d.equals(c), false);
assertEquals(d.equals(d), true);
}
use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method test_atYear_int_invalidYear.
@Test(expectedExceptions = DateTimeException.class)
public void test_atYear_int_invalidYear() {
MonthDay test = MonthDay.of(6, 30);
test.atYear(Integer.MIN_VALUE);
}
use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method test_get.
@Test(dataProvider = "sampleDates")
public void test_get(int m, int d) {
MonthDay a = MonthDay.of(m, d);
assertEquals(a.getMonth(), Month.of(m));
assertEquals(a.getMonthValue(), m);
assertEquals(a.getDayOfMonth(), d);
}
Aggregations