@Test public void cannotCreateLanguageFromVariantCharset() throws Exception { try { Languages.of(new Locale("th","TH","TH")); fail("Should fail when locale is a variant"); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(),equalTo("Language does not allow locale variants (TH)")); } }
public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); }
Languages { public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); } }
Languages { public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); } private  Languages(); }
Languages { public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2); }
Languages { public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2);  }