use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method test_adjustDate.
//-----------------------------------------------------------------------
// adjustInto()
//-----------------------------------------------------------------------
@Test
public void test_adjustDate() {
MonthDay test = MonthDay.of(6, 30);
LocalDate date = LocalDate.of(2007, 1, 1);
assertEquals(test.adjustInto(date), LocalDate.of(2007, 6, 30));
}
use of java.time.MonthDay in project jdk8u_jdk by JetBrains.
the class TCKMonthDay method test_withMonth_int_noChangeEqual.
@Test
public void test_withMonth_int_noChangeEqual() {
MonthDay test = MonthDay.of(6, 30);
assertEquals(test.withMonth(6), test);
}
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);
}
Aggregations