Ejemplo n.º 1
0
  private static void assertObsolete(String newCode, String oldCode, String displayName) {
    // Either code should get you the same locale.
    Locale newLocale = new Locale(newCode);
    Locale oldLocale = new Locale(oldCode);
    assertEquals(newLocale, oldLocale);

    // No matter what code you used to create the locale, you should get the old code back.
    assertEquals(oldCode, newLocale.getLanguage());
    assertEquals(oldCode, oldLocale.getLanguage());

    // Check we get the right display name.
    assertEquals(displayName, newLocale.getDisplayLanguage(newLocale));
    assertEquals(displayName, oldLocale.getDisplayLanguage(newLocale));
    assertEquals(displayName, newLocale.getDisplayLanguage(oldLocale));
    assertEquals(displayName, oldLocale.getDisplayLanguage(oldLocale));

    // Check that none of the 'getAvailableLocales' methods are accidentally returning two
    // equal locales (because to ICU they're different, but we mangle one into the other).
    assertOnce(newLocale, BreakIterator.getAvailableLocales());
    assertOnce(newLocale, Calendar.getAvailableLocales());
    assertOnce(newLocale, Collator.getAvailableLocales());
    assertOnce(newLocale, DateFormat.getAvailableLocales());
    assertOnce(newLocale, DateFormatSymbols.getAvailableLocales());
    assertOnce(newLocale, NumberFormat.getAvailableLocales());
    assertOnce(newLocale, Locale.getAvailableLocales());
  }
 @TestTargetNew(
     level = TestLevel.COMPLETE,
     notes = "",
     method = "getAvailableLocales",
     args = {})
 public void test_getAvailableLocales() {
   assertNotNull(Calendar.getAvailableLocales());
 }
Ejemplo n.º 3
0
 public LocaleSet() {
   locales = Calendar.getAvailableLocales();
   DateFormatSymbols dfs = new DateFormatSymbols();
   names = new String[getLocales().length];
   initLocaleNames();
 }