LocaleUtil { public static List<String> calculateBundleNames(String baseName, Locale locale) { return calculateBundleNames(baseName, locale, false); }  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 calculateBundleNames() { assertBundleNames("", null, null, null, LocaleUtil.calculateBundleNames("", null)); assertBundleNames("", null, null, null, LocaleUtil.calculateBundleNames("", new Locale(""))); assertBundleNames("", "zh", null, null, LocaleUtil.calculateBundleNames("", new Locale("zh"))); assertBundleNames("", "zh", "zh_CN", null, LocaleUtil.calculateBundleNames("", new Locale("zh", "CN"))); assertBundleNames("", "zh", "zh_CN", "zh_CN_variant", LocaleUtil.calculateBundleNames("", new Locale("zh", "CN", "variant"))); assertBundleNames("hello.jsp", null, null, null, LocaleUtil.calculateBundleNames("hello.jsp", null)); assertBundleNames("hello.jsp", null, null, null, LocaleUtil.calculateBundleNames("hello.jsp", new Locale(""))); assertBundleNames("hello.jsp", "hello_zh.jsp", null, null, LocaleUtil.calculateBundleNames("hello.jsp", new Locale("zh"))); assertBundleNames("hello.jsp", "hello_zh.jsp", "hello_zh_CN.jsp", null, LocaleUtil.calculateBundleNames("hello.jsp", new Locale("zh", "CN"))); assertBundleNames("hello.jsp", "hello_zh.jsp", "hello_zh_CN.jsp", "hello_zh_CN_variant.jsp", LocaleUtil.calculateBundleNames("hello.jsp", new Locale("zh", "CN", "variant"))); assertBundleNames("hello", null, null, null, LocaleUtil.calculateBundleNames("hello.", null)); assertBundleNames("hello", null, null, null, LocaleUtil.calculateBundleNames("hello.", new Locale(""))); assertBundleNames("hello", "hello_zh", null, null, LocaleUtil.calculateBundleNames("hello.", new Locale("zh"))); assertBundleNames("hello", "hello_zh", "hello_zh_CN", null, LocaleUtil.calculateBundleNames("hello.", new Locale("zh", "CN"))); assertBundleNames("hello", "hello_zh", "hello_zh_CN", "hello_zh_CN_variant", LocaleUtil.calculateBundleNames("hello.", new Locale("zh", "CN", "variant"))); assertBundleNames("hello.world", null, null, null, LocaleUtil.calculateBundleNames("hello.world", null)); assertBundleNames("hello.world", null, null, null, LocaleUtil.calculateBundleNames("hello.world", new Locale(""), true)); assertBundleNames("hello.world", "hello.world_zh", null, null, LocaleUtil.calculateBundleNames("hello.world", new Locale("zh"), true)); assertBundleNames("hello.world", "hello.world_zh", "hello.world_zh_CN", null, LocaleUtil.calculateBundleNames("hello.world", new Locale("zh", "CN"), true)); assertBundleNames("hello.world", "hello.world_zh", "hello.world_zh_CN", "hello.world_zh_CN_variant", LocaleUtil.calculateBundleNames("hello.world", new Locale("zh", "CN", "variant"), true)); }