LanguageService { public List<String> getLanguageNames() { List<String> languageNames = new ArrayList<>(); for (List<String> list : languageMap.values()) { for (String name : list) { languageNames.add(getTitleCaseName(name)); } } Collections.sort(languageNames); return languageNames; } LanguageService(LanguagesImportUtility langImportUtility); String getLanguageDisplayName(String isoCode); String getIsoForLanguage(String label); List<String> getLanguageNames(); @NonNull static String getTitleCaseName(String name); static final String INVALID_ISO_CODE; static final String INVALID_LANGUAGE_NAME; }
@Test public void shouldReturnListOfAllLanguageNames() { List<String> languageNames = languageService.getLanguageNames(); assertEquals(true, languageNames.contains("Farsi")); assertEquals(true, languageNames.contains("Arabic")); assertEquals(true, languageNames.contains("English")); assertEquals(true, languageNames.contains("Persian")); }