Search in sources :

Example 16 with Year

use of java.time.Year in project jdk8u_jdk by JetBrains.

the class TCKYear method test_atMonth.

//-----------------------------------------------------------------------
// atMonth(Month)
//-----------------------------------------------------------------------
@Test
public void test_atMonth() {
    Year test = Year.of(2008);
    assertEquals(test.atMonth(Month.JUNE), YearMonth.of(2008, 6));
}
Also used : Year(java.time.Year) Test(org.testng.annotations.Test)

Example 17 with Year

use of java.time.Year in project jdk8u_jdk by JetBrains.

the class TCKYear method test_atMonth_nullMonth.

@Test(expectedExceptions = NullPointerException.class)
public void test_atMonth_nullMonth() {
    Year test = Year.of(2008);
    test.atMonth((Month) null);
}
Also used : Year(java.time.Year) Test(org.testng.annotations.Test)

Example 18 with Year

use of java.time.Year in project jdk8u_jdk by JetBrains.

the class TCKYear method test_plusYear_zero_equals.

@Test
public void test_plusYear_zero_equals() {
    Year base = Year.of(2007);
    assertEquals(base.plusYears(0), base);
}
Also used : Year(java.time.Year) Test(org.testng.annotations.Test)

Example 19 with Year

use of java.time.Year in project jdk8u_jdk by JetBrains.

the class TCKYear method factory_parse_formatter.

//-----------------------------------------------------------------------
// parse(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void factory_parse_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("y");
    Year test = Year.parse("2010", f);
    assertEquals(test, Year.of(2010));
}
Also used : Year(java.time.Year) DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 20 with Year

use of java.time.Year in project jdk8u_jdk by JetBrains.

the class TCKYear method test_equals_same.

@Test
public void test_equals_same() {
    Year test = Year.of(2011);
    assertEquals(test.equals(test), true);
}
Also used : Year(java.time.Year) Test(org.testng.annotations.Test)

Aggregations

Year (java.time.Year)34 Test (org.testng.annotations.Test)33 LocalDate (java.time.LocalDate)3 YearMonth (java.time.YearMonth)2 Clock (java.time.Clock)1 DateTimeException (java.time.DateTimeException)1 Instant (java.time.Instant)1 ZoneId (java.time.ZoneId)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 DateTimeParseException (java.time.format.DateTimeParseException)1 Temporal (java.time.temporal.Temporal)1 TemporalAccessor (java.time.temporal.TemporalAccessor)1 UnsupportedTemporalTypeException (java.time.temporal.UnsupportedTemporalTypeException)1