Resources { public static String[] getSingleLocaleSuffixArray(final Locale locale) { if(locale == null) { return EMPTY_STRING_ARRAY; } final String language = locale.getLanguage(); final int languageLength = language.length(); final String country = locale.getCountry(); final int countryLength = country.length(); final String variant = locale.getVariant(); final int variantLength = variant.length(); List<String> resultList = new ArrayList<>(3); if(languageLength + countryLength + variantLength != 0) { final StringBuilder temp = new StringBuilder(); temp.append(language); if(languageLength > 0) { resultList.add(temp.toString()); } if(countryLength + variantLength != 0) { temp.append('_'); temp.append(country); if(countryLength > 0) { resultList.add(temp.toString()); } if(variantLength != 0) { temp.append('_'); temp.append(variant); resultList.add(temp.toString()); } } } String[] result = new String[resultList.size()]; Collections.reverse(resultList); resultList.toArray(result); return result; } private  Resources(); static URL[] getLocalResources(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static URL[] getLocalResources(final Class clazz, final String resourceBaseName, final String[] suffixes); static URL[] getLocalResources(final Class clazz, final String resourceName, final Locale locale); static URL[] getLocalResources(final Class clazz, final String resourceName); static URL getLocalResource(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static URL getLocalResource(final Class clazz, final String resourceBaseName, final String[] suffixes); static URL getLocalResource(final Class clazz, final String resourceName, final Locale locale); static URL getLocalResource(final Class clazz, final String resourceName); static InputStream getLocalResourceAsStream(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static InputStream getLocalResourceAsStream(final Class clazz, final String resourceBaseName, final String[] suffixes); static InputStream getLocalResourceAsStream(final Class clazz, final String resourceName, final Locale locale); static InputStream getLocalResourceAsStream(final Class clazz, final String resourceName); static URL[] getResources(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static URL[] getResources(final Class clazz, final String resourceBaseName, final String[] suffixes); static URL[] getResources(final Class clazz, final String resourceName, final Locale locale); static URL[] getResources(final Class clazz, final String resourceName); static URL getResource(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static URL getResource(final Class clazz, final String resourceBaseName, final String[] suffixes); static URL getResource(final Class clazz, final String resourceName, final Locale locale); static URL getResource(final Class clazz, final String resourceName); static InputStream getResourceAsStream(final Class clazz, final String resourceBaseName, final String[] suffixes, final Locale locale); static InputStream getResourceAsStream(final Class clazz, final String resourceBaseName, final String[] suffixes); static InputStream getResourceAsStream(final Class clazz, final String resourceName, final Locale locale); static InputStream getResourceAsStream(final Class clazz, final String resourceName); static String getShortClassName(final Class clazz); static String[] getLocaleSuffixArray(final Locale locale); static String[] getSingleLocaleSuffixArray(final Locale locale); static String getPathToClass(final Class clazz); static String getPathToPackage(final Class clazz); static final String LINK_SUFFIX; }
@Test public void getSingleLocaleSuffixArray() throws Exception { internalGetSingleLocaleSuffixArray(GERMANY_LOCALE, new String[] { "de_DE", "de", }); internalGetSingleLocaleSuffixArray(HESSIAN_LOCALE, new String[] { "de_DE_hessisch", "de_DE", "de", }); internalGetSingleLocaleSuffixArray(new Locale("", "", "foo"), new String[] { "__foo", }); internalGetSingleLocaleSuffixArray(new Locale("foo", "", "bar"), new String[] { "foo__bar", "foo", }); internalGetSingleLocaleSuffixArray(EMPTY_LOCALE, new String[]{}); internalGetSingleLocaleSuffixArray(null, new String[]{}); }