use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_until_convertedType.
@Test
public void test_until_convertedType() {
YearMonth start = YearMonth.of(2010, 6);
LocalDate end = start.plusMonths(2).atDay(12);
assertEquals(start.until(end, MONTHS), 2);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_with_Year.
//-----------------------------------------------------------------------
// with(Year)
//-----------------------------------------------------------------------
@Test
public void test_with_Year() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.with(Year.of(2000)), YearMonth.of(2000, 6));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_plusYears_long_negative.
@Test
public void test_plusYears_long_negative() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.plusYears(-1), YearMonth.of(2007, 6));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusYears_long_negative.
@Test
public void test_minusYears_long_negative() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.minusYears(-1), YearMonth.of(2009, 6));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusMonths_long_big.
@Test
public void test_minusMonths_long_big() {
YearMonth test = YearMonth.of(40, 6);
long months = 20L + Integer.MAX_VALUE;
assertEquals(test.minusMonths(months), YearMonth.of((int) (40L - months / 12), 6 - (int) (months % 12)));
}
Aggregations