use of java.time.chrono.MinguoChronology in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_InvalidEras.
//-----------------------------------------------------------------------
// Bad Era for Chronology.date(era,...) and Chronology.prolepticYear(Era,...)
//-----------------------------------------------------------------------
@Test
public void test_InvalidEras() {
// Verify that the eras from every other Chronology are invalid
for (Chronology chrono : Chronology.getAvailableChronologies()) {
if (chrono instanceof MinguoChronology) {
continue;
}
List<Era> eras = chrono.eras();
for (Era era : eras) {
try {
ChronoLocalDate date = MinguoChronology.INSTANCE.date(era, 1, 1, 1);
fail("MinguoChronology.date did not throw ClassCastException for Era: " + era);
} catch (ClassCastException cex) {
// ignore expected exception
;
}
try {
@SuppressWarnings("unused") int year = MinguoChronology.INSTANCE.prolepticYear(era, 1);
fail("MinguoChronology.prolepticYear did not throw ClassCastException for Era: " + era);
} catch (ClassCastException cex) {
// ignore expected exception
;
}
}
}
}
Aggregations