@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()));
}