use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_resolve_ymaa_lenient.
@Test(dataProvider = "resolve_ymaa")
public void test_resolve_ymaa_lenient(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_isLeapYear.
@Test(dataProvider = "prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_resolve_yd_lenient.
@Test(dataProvider = "resolve_yd")
public void test_resolve_yd_lenient(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_adjust_toMonth.
@Test(expectedExceptions = DateTimeException.class)
public void test_adjust_toMonth() {
MinguoDate minguo = MinguoChronology.INSTANCE.date(1726, 1, 4);
minguo.with(Month.APRIL);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_periodUntilDiffChrono.
@Test
public void test_periodUntilDiffChrono() {
JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
ChronoPeriod period = mdate1.until(ldate2);
assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
}
Aggregations