Пример #1
0
 @Test(dataProvider = "calendarsystemtype")
 public void test_lookupLocale(Chronology chrono, String calendarType) {
   Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA");
   builder.setUnicodeLocaleKeyword("ca", calendarType);
   Locale locale = builder.build();
   assertEquals(Chronology.ofLocale(locale), chrono);
 }
Пример #2
0
  @Test(expectedExceptions = DateTimeException.class)
  public void test_lookupLocale() {
    Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA");
    builder.setUnicodeLocaleKeyword("ca", "xxx");

    Locale locale = builder.build();
    Chronology.ofLocale(locale);
  }
Пример #3
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");
   }
 }