### Question:
LocaleConverter implements Converter<Locale>, Serializable { @Override public Locale convert(final String value) { String localeValue = value.trim(); if (localeValue.isEmpty()) { return null; } Locale locale = Locale.forLanguageTag(NORMALIZE_LOCALE_PATTERN.matcher(localeValue).replaceAll("-")); if (locale != Locale.ROOT && (locale.getLanguage() == null || locale.getLanguage().isEmpty())) { throw new IllegalArgumentException("Unable to resolve locale: " + value); } return locale; } LocaleConverter(); @Override Locale convert(final String value);  }### Answer:
@Test public void testStandardLocale() { LocaleConverter localeConverter = new LocaleConverter(); Locale locale = localeConverter.convert("fr-FR"); assertEquals("fr", locale.getLanguage()); assertEquals("FR", locale.getCountry()); }
@Test public void testUnderscoreLocale() { LocaleConverter localeConverter = new LocaleConverter(); Locale locale = localeConverter.convert("fr_FR"); assertEquals("fr", locale.getLanguage()); assertEquals("FR", locale.getCountry()); }
@Test public void testCLocale() { LocaleConverter localeConverter = new LocaleConverter(); Locale locale = localeConverter.convert("c.u-US"); assertSame(Locale.ROOT, locale); }
@Test public void testEmptyLocale() { LocaleConverter localeConverter = new LocaleConverter(); Locale locale = localeConverter.convert(""); assertNull(locale); }