AbstractI18nCodeList extends AbstractCodeList implements
                                           I18nCodeList, InitializingBean { @Override public Map<String, String> asMap() { return asMap(LocaleContextHolder.getLocale()); }  void setFallbackTo(Locale fallbackTo); @Override Map<String, String> asMap(); @Override Map<String, String> asMap(Locale locale); @Override void afterPropertiesSet();  }
@Test public void testAsMap() { AbstractI18nCodeList impl = new AbstractI18nCodeList() { @Override protected Set<Locale> registerCodeListLocales() { return Sets.newHashSet(); } @Override protected Map<String, String> obtainMap(Locale locale) { return Collections.singletonMap("language", locale .getLanguage()); } }; Locale.setDefault(Locale.ENGLISH); assertThat(impl.asMap().get("language"), is(Locale.ENGLISH .getLanguage())); LocaleContextHolder.setLocale(Locale.GERMAN); assertThat(impl.asMap().get("language"), is(Locale.GERMAN .getLanguage())); LocaleContextHolder.setLocale(Locale.FRENCH); assertThat(impl.asMap().get("language"), is(Locale.FRENCH .getLanguage())); Locale.setDefault(Locale.JAPANESE); assertThat(impl.asMap().get("language"), is(Locale.FRENCH .getLanguage())); }