### Question:
LocaleUtil { public static TextValue findClosestLocale(Collection<TextValue> textValues, Locale localeToMatch) { return findClosestLocale(textValues, localeToMatch, Locale.ENGLISH); }  static TextValue findClosestLocale(Collection<TextValue> textValues, Locale localeToMatch); static TextValue findClosestLocale(Collection<TextValue> textValues, Locale localeToMatch, Locale defaultLocale); static Locale findClosestLocale(Set<Locale> locales, Locale localeToMatch); static Locale findClosestLocale(Set<Locale> locales, Locale localeToMatch, Locale defaultLocale); static Locale getSimpleLocale(String languageString);  }### Answer:
@Test public void testClosestLocale() { Set<Locale> list = new LinkedHashSet<Locale>(Arrays.asList( new Locale("es"), new Locale("en", "GB"), new Locale("en", "US"), new Locale("ko"))); assertEquals("es", LocaleUtil.findClosestLocale(list, new Locale("es")).getLanguage()); assertEquals("en_GB", LocaleUtil.findClosestLocale(list, new Locale("en", "GB")).toString()); assertEquals("en_GB", LocaleUtil.findClosestLocale(list, new Locale("en")).toString()); assertEquals("ko", LocaleUtil.findClosestLocale(list, Locale.KOREAN).getLanguage()); assertEquals("ko", LocaleUtil.findClosestLocale(list, Locale.KOREA).toString()); assertEquals("en_GB", LocaleUtil.findClosestLocale(list, Locale.JAPANESE, Locale.CANADA).toString()); assertEquals("en_US", LocaleUtil.findClosestLocale(list, Locale.JAPANESE, Locale.US).toString()); }