use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TestReducedPrinter method test_minguoChrono_extendedWidth.
public void test_minguoChrono_extendedWidth() throws Exception {
// ISO 2021 is Minguo 110
DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 4, 2021);
MinguoDate date = MinguoDate.of(109, 6, 30);
assertEquals(f.format(date), "109");
date = MinguoDate.of(110, 6, 30);
assertEquals(f.format(date), "10");
date = MinguoDate.of(199, 6, 30);
assertEquals(f.format(date), "99");
date = MinguoDate.of(200, 6, 30);
assertEquals(f.format(date), "00");
date = MinguoDate.of(209, 6, 30);
assertEquals(f.format(date), "09");
date = MinguoDate.of(210, 6, 30);
assertEquals(f.format(date), "210");
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKThaiBuddhistChronology method test_periodUntilDiffChrono.
@Test
public void test_periodUntilDiffChrono() {
ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
ChronoPeriod period = mdate1.until(ldate2);
assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1));
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches.
@Test
public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches() {
MinguoDate mdt = MinguoDate.of(100, 6, 30);
ChronoZonedDateTime<MinguoDate> mzdt = mdt.atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mzdt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method test_periodUntilDiffChrono.
// Test to get the Period between dates in different chronologies
@Test(dataProvider = "datesForPeriod")
public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, ChronoPeriod p) {
MinguoDate m = MinguoChronology.INSTANCE.date(h2);
ChronoPeriod period = h1.until(m);
assertEquals(period, p);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_adjust1.
//-----------------------------------------------------------------------
// with(DateTimeAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_adjust1() {
MinguoDate base = MinguoChronology.INSTANCE.date(2012, 10, 29);
MinguoDate test = base.with(TemporalAdjusters.lastDayOfMonth());
assertEquals(test, MinguoChronology.INSTANCE.date(2012, 10, 31));
}
Aggregations