use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_resolve_yearOfEra_eraAndYearOnly_valid.
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOnly_valid(ResolverStyle style, JapaneseEra era) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.ERA, (long) era.getValue());
fieldValues.put(ChronoField.YEAR, 1L);
JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
assertEquals(date, null);
assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1L);
assertEquals(fieldValues.size(), 2);
}
use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_with_TemporalField_long.
//-----------------------------------------------------------------------
// with(TemporalField, long)
//-----------------------------------------------------------------------
@Test
public void test_with_TemporalField_long() {
JapaneseDate base = JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 63, 6, 30);
JapaneseDate test = base.with(YEAR, 1987);
assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 62, 6, 30));
test = test.with(YEAR_OF_ERA, 2);
assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 2, 6, 30));
test = test.with(ERA, JapaneseEra.HEISEI.getValue());
assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 6, 30));
test = test.with(MONTH_OF_YEAR, 3);
assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 3, 30));
test = test.with(DAY_OF_MONTH, 4);
assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 3, 4));
}
use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_periodUntilDate.
//-----------------------------------------------------------------------
// PeriodUntil()
//-----------------------------------------------------------------------
@Test
public void test_periodUntilDate() {
JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
ChronoPeriod period = mdate1.until(mdate2);
assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
}
use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_resolve_yearOfEra_eraOnly_valid.
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, JapaneseEra era) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.ERA, (long) era.getValue());
JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
assertEquals(date, null);
assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
assertEquals(fieldValues.size(), 1);
}
use of java.time.chrono.JapaneseDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_createByEra_epochDay.
@Test(dataProvider = "createByEra")
public void test_createByEra_epochDay(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
assertEquals(test.getLong(EPOCH_DAY), iso.getLong(EPOCH_DAY));
assertEquals(test.toEpochDay(), iso.toEpochDay());
}
Aggregations