### Question:
ExtenderUtils { public static Locale getLocaleFromResourceName(String name) { final int index = name.indexOf('_'); if (index != -1) { String locale = name.substring(index + 1); if (locale.lastIndexOf('.') != -1) { int lastDot = locale.lastIndexOf('.'); locale = locale.substring(0, lastDot) .replace("_", "-"); } return Locale.forLanguageTag(locale); } else { return InternationalizationService.DEFAULT_LOCALE; } } private  ExtenderUtils(); static List<I18nExtension> analyze(String path, Bundle bundle); static Locale getLocaleFromResourceName(String name);  }### Answer:
@Test public void testGetLocaleFromResourceName() throws Exception { assertThat(ExtenderUtils.getLocaleFromResourceName("messages.properties")).isEqualTo (InternationalizationService.DEFAULT_LOCALE); assertThat(ExtenderUtils.getLocaleFromResourceName("messages_fr.properties")).isEqualTo (Locale.FRENCH); assertThat(ExtenderUtils.getLocaleFromResourceName("messages_fr-fr.properties")).isEqualTo (Locale.FRANCE); assertThat(ExtenderUtils.getLocaleFromResourceName("messages_en.properties")).isEqualTo (Locale.ENGLISH); assertThat(ExtenderUtils.getLocaleFromResourceName("messages_en-ca.properties")).isEqualTo (Locale.CANADA); assertThat(ExtenderUtils.getLocaleFromResourceName("labels_en.properties")).isEqualTo (Locale.ENGLISH); assertThat(ExtenderUtils.getLocaleFromResourceName("labels_en_US.properties")).isEqualTo (Locale.US); }