use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_equals.
//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
@Test
public void test_equals() {
for (int i = -4; i <= 2104; i++) {
Year a = Year.of(i);
for (int j = -4; j <= 2104; j++) {
Year b = Year.of(j);
assertEquals(a.equals(b), i == j);
assertEquals(a.hashCode() == b.hashCode(), i == j);
}
}
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_until_convertedType.
@Test
public void test_until_convertedType() {
Year start = Year.of(2010);
YearMonth end = start.plusYears(2).atMonth(Month.APRIL);
assertEquals(start.until(end, YEARS), 2);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_atMonth_int_invalidMonth.
@Test(expectedExceptions = DateTimeException.class)
public void test_atMonth_int_invalidMonth() {
Year test = Year.of(2008);
test.atMonth(13);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method now.
//-----------------------------------------------------------------------
// now()
//-----------------------------------------------------------------------
@Test
public void now() {
Year expected = Year.now(Clock.systemDefaultZone());
Year test = Year.now();
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = Year.now(Clock.systemDefaultZone());
test = Year.now();
}
assertEquals(test, expected);
}
use of java.time.Year in project jdk8u_jdk by JetBrains.
the class TCKYear method test_equals_incorrectType.
@Test
public void test_equals_incorrectType() {
Year test = Year.of(1);
assertEquals(test.equals("Incorrect type"), false);
}
Aggregations