@Test public void doesNotParseLanguagesWithHyphenPrimaryTag() throws Exception { try { Languages.fromString("-"); fail("Should fail when cannot find sensible media range"); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(),startsWith("Invalid language-range: ")); } }
public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } private  Languages(); }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } 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 fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } 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);  }