use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_toString.
@Test(dataProvider = "sampleToString")
public void test_toString(int y, int m, String expected) {
YearMonth test = YearMonth.of(y, m);
String str = test.toString();
assertEquals(str, expected);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_lengthOfMonth_febNonLeap.
@Test
public void test_lengthOfMonth_febNonLeap() {
YearMonth test = YearMonth.of(2007, 2);
assertEquals(test.lengthOfMonth(), 28);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_with_Month_null.
@Test(expectedExceptions = NullPointerException.class)
public void test_with_Month_null() {
YearMonth test = YearMonth.of(2008, 6);
test.with((Month) null);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method now.
//-----------------------------------------------------------------------
// now()
//-----------------------------------------------------------------------
@Test
public void now() {
YearMonth expected = YearMonth.now(Clock.systemDefaultZone());
YearMonth test = YearMonth.now();
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = YearMonth.now(Clock.systemDefaultZone());
test = YearMonth.now();
}
assertEquals(test, expected);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusMonths_long_invalidTooLarge.
@Test(expectedExceptions = { DateTimeException.class })
public void test_plusMonths_long_invalidTooLarge() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.plusMonths(1);
}
Aggregations