Content { public static Locale getLocale(Label label) { return Optional.ofNullable(label.localeLanguageTag()).filter(StringUtils::isNotEmpty) .map(Locale::forLanguageTag).orElse(Locale.getDefault()); }  static Locale getLocale(Label label);  }
@Test public void t01_label_locale_default() { Label l = create("TEST", Label.DEFAULT_LOCALE_LANGUAGE_TAG); assertSame(Locale.getDefault(), Content.getLocale(l)); }
@Test public void t02_label_locale_french() { Label l = create("TEST", "fr"); assertSame(Locale.FRENCH, Content.getLocale(l)); }
@Test public void t03_label_locale_en() { Label l = create("TEST", "en"); assertSame(Locale.ENGLISH, Content.getLocale(l)); }
@Test public void t04_label_locale_en_us() { Label l = create("TEST", "en-US"); assertSame(Locale.US, Content.getLocale(l)); }
@Test public void t05_label_locale_en_us_ignoreCase() { Label l = create("TEST", "EN-us"); assertSame(Locale.US, Content.getLocale(l)); }
@Test public void t06_label_locale_custom() { Label l = create("TEST", "hi-in"); assertEquals(new Locale("hi", "IN"), Content.getLocale(l)); }
@Test public void t07_label_locale_null() { Label l = create("TEST", null); assertEquals(Locale.getDefault(), Content.getLocale(l)); }
@Test public void t08_label_locale_empty() { Label l = create("TEST", ""); assertEquals(Locale.getDefault(), Content.getLocale(l)); }