@Test public void testGetAllLocales() { final Locale locale1 = new Locale("de"); // fallback languages final Locale locale2 = new Locale("en"); final Locale locale3 = new Locale("pl"); when(localizationService.getAllLocales(locale1)) .thenReturn((Locale[]) Arrays.asList(locale1, locale2, locale3).toArray()); final Locale[] allLocales = i18NService.getAllLocales(locale1); assertEquals( "Wrong number of all locales for: '" + locale1.getLanguage() + "'! Should be: '" + NUMBER_OF_ALL_LOCALES + "' but was: '" + allLocales.length + "'.", NUMBER_OF_ALL_LOCALES, allLocales.length); verify(localizationService, times(1)).getAllLocales(locale1); }