Пример #1
0
 @Test(dataProvider = "calendarNameAndType")
 public void test_required_calendars(String chronoId, String calendarSystemType) {
   Chronology chrono = Chronology.of(chronoId);
   assertNotNull(chrono, "Required calendar not found by ID: " + chronoId);
   chrono = Chronology.of(calendarSystemType);
   assertNotNull(chrono, "Required calendar not found by type: " + chronoId);
   Set<Chronology> cals = Chronology.getAvailableChronologies();
   assertTrue(cals.contains(chrono), "Required calendar not found in set of available calendars");
 }
Пример #2
0
 /**
  * Test lookup by calendarType of each chronology. Verify that the calendar can be found by {@link
  * java.time.chrono.Chronology#ofLocale}.
  */
 @Test
 public void test_ofLocaleByType() {
   // Test that all available chronologies can be successfully found using ofLocale
   Set<Chronology> chronos = Chronology.getAvailableChronologies();
   for (Chronology chrono : chronos) {
     Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA");
     builder.setUnicodeLocaleKeyword("ca", chrono.getCalendarType());
     Locale locale = builder.build();
     assertEquals(Chronology.ofLocale(locale), chrono, "Lookup by type");
   }
 }
Пример #3
0
 @Test
 public void test_calendar_list() {
   Set<Chronology> chronos = Chronology.getAvailableChronologies();
   assertNotNull(chronos, "Required list of calendars must be non-null");
   for (Chronology chrono : chronos) {
     Chronology lookup = Chronology.of(chrono.getId());
     assertNotNull(lookup, "Required calendar not found: " + chrono);
   }
   assertEquals(
       chronos.size() >= data_of_calendars().length,
       true,
       "Chronology.getAvailableChronologies().size = "
           + chronos.size()
           + ", expected >= "
           + data_of_calendars().length);
 }