Languages { public static LanguageDetails getLocale(Locale locale) { Locale result = locale; if (result == null) { result = DEFAULT_CODE; } final LanguageDetails localeValue = languageMap.get(result); if (localeValue == null) { result = DEFAULT_CODE; } return languageMap.get(result); }  static LanguageDetails getLocale(Locale locale); static Collection<LanguageDetails> getAllLanguageDetails(); static Collection<Locale> getAllCodes();  }
@Test void shouldGetValidLocale() { LanguageDetails result = Languages.getLocale(new Locale("eng", "GB")); assertEquals("English", result.getLabel()); assertTrue(result.getFlags().get(0).contains("Flag_of_the_United_Kingdom")); }
@Test void shouldGetNullLocale() { LanguageDetails result = Languages.getLocale(null); assertEquals("Français", result.getLabel()); assertTrue(result.getFlags().get(0).contains("Flag_of_France")); }
@Test void shouldGetInvalidLocale() { LanguageDetails result = Languages.getLocale(new Locale("invalid", "locale")); assertEquals("Français", result.getLabel()); assertTrue(result.getFlags().get(0).contains("Flag_of_France")); }