use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_with_Month_noChange_equal.
@Test
public void test_with_Month_noChange_equal() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.with(Month.JUNE), test);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusMonths_long_invalidTooLargeMaxAddMin.
@Test(expectedExceptions = DateTimeException.class)
public void test_plusMonths_long_invalidTooLargeMaxAddMin() {
YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
test.plusMonths(Long.MIN_VALUE);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusYears_long_invalidTooLargeMaxSubtractMin.
@Test(expectedExceptions = DateTimeException.class)
public void test_minusYears_long_invalidTooLargeMaxSubtractMin() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 12);
test.minusYears(Long.MIN_VALUE);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_adjustDate.
//-----------------------------------------------------------------------
// adjustInto()
//-----------------------------------------------------------------------
@Test
public void test_adjustDate() {
YearMonth test = YearMonth.of(2008, 6);
LocalDate date = LocalDate.of(2007, 1, 1);
assertEquals(test.adjustInto(date), LocalDate.of(2008, 6, 1));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method factory_parse_formatter.
//-----------------------------------------------------------------------
// parse(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void factory_parse_formatter() {
DateTimeFormatter f = DateTimeFormatter.ofPattern("y M");
YearMonth test = YearMonth.parse("2010 12", f);
assertEquals(test, YearMonth.of(2010, 12));
}
Aggregations