LocaleUtil { public static boolean isLocaleSupported(Locale locale) { return locale != null && AvailableLocalesLoader.locales.AVAILABLE_LANGUAGES.contains(locale.getLanguage()) && AvailableLocalesLoader.locales.AVAILABLE_COUNTRIES.contains(locale.getCountry()); }  static boolean isLocaleSupported(Locale locale); static boolean isCharsetSupported(String charset); static Locale parseLocale(String localeString); static String getCanonicalCharset(String charset); static List<String> calculateBundleNames(String baseName, Locale locale); static List<String> calculateBundleNames(String baseName, Locale locale, boolean noext); static LocaleInfo getSystem(); static LocaleInfo getDefault(); static LocaleInfo setDefault(Locale locale); static LocaleInfo setDefault(Locale locale, String charset); static LocaleInfo setDefault(LocaleInfo localeInfo); static void resetDefault(); static LocaleInfo getContext(); static LocaleInfo setContext(Locale locale); static LocaleInfo setContext(Locale locale, String charset); static LocaleInfo setContext(LocaleInfo localeInfo); static void resetContext();  }
@Test public void isLocaleSupported() { assertTrue(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("zh"))); assertTrue(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("zh_CN"))); assertTrue(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("zh_CN_aa"))); assertFalse(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("aa"))); assertFalse(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("aa_bb"))); assertFalse(LocaleUtil.isLocaleSupported(LocaleUtil.parseLocale("aa_bb_cc"))); }