use of java.time.chrono.Era in project jdk8u_jdk by JetBrains.
the class TCKHijrahChronology 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 HijrahChronology) {
continue;
}
List<Era> eras = chrono.eras();
for (Era era : eras) {
try {
ChronoLocalDate date = HijrahChronology.INSTANCE.date(era, 1, 1, 1);
fail("HijrahChronology.date did not throw ClassCastException for Era: " + era);
} catch (ClassCastException cex) {
// ignore expected exception
;
}
try {
@SuppressWarnings("unused") int year = HijrahChronology.INSTANCE.prolepticYear(era, 1);
fail("HijrahChronology.prolepticYear did not throw ClassCastException for Era: " + era);
} catch (ClassCastException cex) {
// ignore expected exception
;
}
}
}
}
use of java.time.chrono.Era in project jdk8u_jdk by JetBrains.
the class TCKJapaneseEra method test_values.
//-----------------------------------------------------------------------
// values()
//-----------------------------------------------------------------------
@Test
public void test_values() {
List<Era> eraList = JapaneseChronology.INSTANCE.eras();
JapaneseEra[] eras = JapaneseEra.values();
assertEquals(eraList.size(), eras.length);
for (JapaneseEra era : eras) {
assertTrue(eraList.contains(era));
}
}
use of java.time.chrono.Era in project jdk8u_jdk by JetBrains.
the class TCKThaiBuddhistChronology method test_prolepticYear.
@Test(dataProvider = "prolepticYear")
public void test_prolepticYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
Era eraObj = ThaiBuddhistChronology.INSTANCE.eraOf(eraValue);
assertTrue(ThaiBuddhistChronology.INSTANCE.eras().contains(eraObj));
assertEquals(eraObj, era);
assertEquals(ThaiBuddhistChronology.INSTANCE.prolepticYear(era, yearOfEra), expectedProlepticYear);
}
use of java.time.chrono.Era in project jdk8u_jdk by JetBrains.
the class TCKMinguoEra method test_values.
//-----------------------------------------------------------------------
// values()
//-----------------------------------------------------------------------
@Test
public void test_values() {
List<Era> eraList = MinguoChronology.INSTANCE.eras();
MinguoEra[] eras = MinguoEra.values();
assertEquals(eraList.size(), eras.length);
for (MinguoEra era : eras) {
assertTrue(eraList.contains(era));
}
}
use of java.time.chrono.Era in project jdk8u_jdk by JetBrains.
the class TCKHijrahEra method test_values.
//-----------------------------------------------------------------------
// values()
//-----------------------------------------------------------------------
@Test
public void test_values() {
List<Era> eraList = HijrahChronology.INSTANCE.eras();
HijrahEra[] eras = HijrahEra.values();
assertEquals(eraList.size(), eras.length);
for (HijrahEra era : eras) {
assertTrue(eraList.contains(era));
}
}
Aggregations