Search in sources :

Example 26 with JapaneseDate

use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.

the class TCKJapaneseChronology method test_createByEra_isEqual.

@Test(dataProvider = "createByEra")
public void test_createByEra_isEqual(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
    JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
    assertEquals(test.isEqual(iso), true);
    assertEquals(iso.isEqual(test), true);
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 27 with JapaneseDate

use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.

the class TCKJapaneseChronology method test_adjust_toMonth.

@Test(expectedExceptions = DateTimeException.class)
public void test_adjust_toMonth() {
    JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1926, 1, 4);
    jdate.with(Month.APRIL);
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 28 with JapaneseDate

use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.

the class TCKJapaneseChronology method test_resolve_yearOfEra_yearOfEraAndYearOnly_valid.

@Test(dataProvider = "resolve_styles")
public void test_resolve_yearOfEra_yearOfEraAndYearOnly_valid(ResolverStyle style) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1L);
    fieldValues.put(ChronoField.YEAR, 2012L);
    JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (Long) 1L);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 2012L);
    assertEquals(fieldValues.size(), 2);
}
Also used : TemporalField(java.time.temporal.TemporalField) HashMap(java.util.HashMap) JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 29 with JapaneseDate

use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.

the class TCKJapaneseChronology method test_LocalDateTime_adjustToJapaneseDate.

@Test
public void test_LocalDateTime_adjustToJapaneseDate() {
    JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1928, 10, 29);
    LocalDateTime test = LocalDateTime.MIN.with(jdate);
    assertEquals(test, LocalDateTime.of(1928, 10, 29, 0, 0));
}
Also used : LocalDateTime(java.time.LocalDateTime) JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 30 with JapaneseDate

use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.

the class TCKJapaneseChronology method test_createByEra_query.

@Test(dataProvider = "createByEra")
public void test_createByEra_query(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
    JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
    assertEquals(test.query(TemporalQueries.localDate()), iso);
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Aggregations

JapaneseDate (java.time.chrono.JapaneseDate)42 Test (org.testng.annotations.Test)42 TemporalField (java.time.temporal.TemporalField)12 HashMap (java.util.HashMap)12 DateTimeException (java.time.DateTimeException)5 OffsetDateTime (java.time.OffsetDateTime)2 ChronoPeriod (java.time.chrono.ChronoPeriod)2 JapaneseEra (java.time.chrono.JapaneseEra)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 Locale (java.util.Locale)2 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 ChronoLocalDate (java.time.chrono.ChronoLocalDate)1 MinguoDate (java.time.chrono.MinguoDate)1 ValueRange (java.time.temporal.ValueRange)1