LocaleUtil { public static boolean isCharsetSupported(String charset) { return charset != null && Charset.isSupported(charset); }  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 isCharsetSupported() { assertTrue(LocaleUtil.isCharsetSupported("GBK")); assertTrue(LocaleUtil.isCharsetSupported("8859_1")); assertTrue(LocaleUtil.isCharsetSupported("iso8859_1")); assertTrue(LocaleUtil.isCharsetSupported("iso-8859-1")); assertFalse(LocaleUtil.isCharsetSupported(null)); assertFalse(LocaleUtil.isCharsetSupported("hello")); }