Search in sources :

Example 6 with JapaneseDate

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

the class TCKJapaneseChronology method test_createEyd.

@Test(dataProvider = "createByEra")
public void test_createEyd(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
    JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.dateYearDay(era, yoe, doy);
    JapaneseDate dateByDateFactory = JapaneseDate.of(era, yoe, moy, dom);
    assertEquals(dateByChronoFactory, dateByDateFactory);
    assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 7 with JapaneseDate

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

the class TCKJapaneseChronology method test_createByEra_chronologyTemporalFactory.

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

Example 8 with JapaneseDate

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

the class TCKJapaneseChronology method test_createEymd.

@Test(dataProvider = "createByEra")
public void test_createEymd(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
    JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.date(era, yoe, moy, dom);
    JapaneseDate dateByDateFactory = JapaneseDate.of(era, yoe, moy, dom);
    assertEquals(dateByChronoFactory, dateByDateFactory);
    assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 9 with JapaneseDate

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

the class TCKJapaneseChronology method test_getLong.

//-----------------------------------------------------------------------
// get(TemporalField)
//-----------------------------------------------------------------------
@Test
public void test_getLong() {
    JapaneseDate base = JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 63, 6, 30);
    assertEquals(base.getLong(ERA), JapaneseEra.SHOWA.getValue());
    assertEquals(base.getLong(YEAR), 1988L);
    assertEquals(base.getLong(YEAR_OF_ERA), 63L);
    assertEquals(base.getLong(MONTH_OF_YEAR), 6L);
    assertEquals(base.getLong(DAY_OF_MONTH), 30L);
}
Also used : JapaneseDate(java.time.chrono.JapaneseDate) Test(org.testng.annotations.Test)

Example 10 with JapaneseDate

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

the class TCKJapaneseChronology method test_periodUntilUnit.

@Test
public void test_periodUntilUnit() {
    JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
    JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
    long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
    assertEquals(months, 13);
}
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