use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusYears_long_noChange_equal.
@Test
public void test_minusYears_long_noChange_equal() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.minusYears(0), test);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_with_Month.
//-----------------------------------------------------------------------
// with(Month)
//-----------------------------------------------------------------------
@Test
public void test_with_Month() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.with(Month.JANUARY), YearMonth.of(2008, 1));
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_hashCode.
//-----------------------------------------------------------------------
// hashCode()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleDates")
public void test_hashCode(int y, int m) {
YearMonth a = YearMonth.of(y, m);
assertEquals(a.hashCode(), a.hashCode());
YearMonth b = YearMonth.of(y, m);
assertEquals(a.hashCode(), b.hashCode());
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method now_Clock.
//-----------------------------------------------------------------------
// now(Clock)
//-----------------------------------------------------------------------
@Test
public void now_Clock() {
Instant instant = LocalDateTime.of(2010, 12, 31, 0, 0).toInstant(ZoneOffset.UTC);
Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
YearMonth test = YearMonth.now(clock);
assertEquals(test.getYear(), 2010);
assertEquals(test.getMonth(), Month.DECEMBER);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minusMonths_long_invalidTooSmall.
@Test(expectedExceptions = { DateTimeException.class })
public void test_minusMonths_long_invalidTooSmall() {
YearMonth test = YearMonth.of(Year.MIN_VALUE, 1);
test.minusMonths(1);
}
Aggregations