Resources { public static String[] getLocaleSuffixArray(final Locale locale) { String[] localeSuf = getSingleLocaleSuffixArray(locale); String[] defaultSuf = getSingleLocaleSuffixArray(Locale.getDefault()); List<String> resultList = new ArrayList<>(localeSuf.length + defaultSuf.length); for(String currentSuffix : localeSuf) { if(!resultList.contains(currentSuffix)) { resultList.add(currentSuffix); } } for(String currentSuffix : defaultSuf) { if(!resultList.contains(currentSuffix)) { resultList.add(currentSuffix); } } String[] result = new String[resultList.size()]; 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 getLocaleSuffixArray() throws Exception { internalGetLocaleSuffixArray(GERMANY_LOCALE, new String[] { "de_DE", "de", "en_US", "en", }); internalGetLocaleSuffixArray(HESSIAN_LOCALE, new String[] { "de_DE_hessisch", "de_DE", "de", "en_US", "en", }); internalGetLocaleSuffixArray(new Locale("", "", "foo"), new String[] { "__foo", "en_US", "en", }); internalGetLocaleSuffixArray(new Locale("foo", "", "bar"), new String[] { "foo__bar", "foo", "en_US", "en", }); internalGetLocaleSuffixArray(EMPTY_LOCALE, new String[] { "en_US", "en", }); internalGetLocaleSuffixArray(null, new String[] { "en_US", "en", }); internalGetLocaleSuffixArray(US_LOCALE, new String[] { "en_US", "en", }); Locale.setDefault(EMPTY_LOCALE); internalGetLocaleSuffixArray(EMPTY_LOCALE, new String[]{}); }