### Question:
LocaleUtils extends org.apache.commons.lang3.LocaleUtils { public static Locale toLocale(String str) { if (str != null && str.isEmpty()) { return Locale.ROOT; } return org.apache.commons.lang3.LocaleUtils.toLocale(str); }  static Locale getParentLocale(Locale locale); static Locale toLocale(String str); static Locale toLocale(String str, Locale fallback);  }### Answer:
@Test public void toLocale() { Assert.assertEquals(null, LocaleUtils.toLocale(null)); Assert.assertEquals(Locale.ROOT, LocaleUtils.toLocale("")); Assert.assertEquals(Locale.ENGLISH, LocaleUtils.toLocale("en")); Assert.assertEquals(Locale.US, LocaleUtils.toLocale("en_US")); Assert.assertEquals(Locale.FRENCH, LocaleUtils.toLocale("badLocale", Locale.FRENCH)); }