### Question:
AcceptableLanguage { public static AcceptableLanguage valueOf(String value) { if (WILDCARD.equals(value)) { return new AcceptableLanguage(WILDCARD, null, 1d); } else { String[] parts = value.split(";\\s*"); if (parts.length > 2) { throw new IllegalArgumentException("'" + value + "' is not a valid language tag"); } String tag = parts[0].trim(); if (!isValid(tag)) { throw new IllegalArgumentException("'" + value + "' is not a valid language tag"); } String primaryTag = tag; String subTag = null; int subIndex = tag.indexOf('-'); if (subIndex != -1) { primaryTag = tag.substring(0, subIndex); subTag = tag.substring(subIndex + 1, tag.length()); } double q = 1d; if (parts.length > 1) { String parameter = parts[1].trim(); int eqIndex = parameter.indexOf('='); if (eqIndex != -1) { String attribute = parameter.substring(0, eqIndex); if (!"q".equals(attribute)) { throw new IllegalArgumentException("'" + value + "' is not a valid language tag"); } q = Double.valueOf(parameter.substring(eqIndex + 1, parameter.length())); checkQuality(q); } } return new AcceptableLanguage(primaryTag, subTag, q); } } private  AcceptableLanguage(String primaryTag, String subTags, double quality); String getPrimaryTag(); String getSubTags(); double getQuality(); Locale asLocale(); boolean includes(Locale tag); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static List<AcceptableLanguage> valuesOf(String values); static AcceptableLanguage valueOf(String value); static Locale bestCandidate(List<AcceptableLanguage> ranges, Collection<Locale> candidates); static boolean accepts(List<AcceptableLanguage> ranges, Locale candidate); static final AcceptableLanguage ANY; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testWithInvalidQualityFactory() { AcceptableLanguage.valueOf("en-US; q=1.1"); }
@Test(expected = IllegalArgumentException.class) public void testWithMultipleParameters() { AcceptableLanguage.valueOf("en-US; q=0.7; a=b"); }
@Test(expected = IllegalArgumentException.class) public void testWildcardWithSubTag() { AcceptableLanguage.valueOf("*-en"); }
@Test(expected = IllegalArgumentException.class) public void testWildcardWithEmptySubTag() { AcceptableLanguage.valueOf("*-"); }
@Test(expected = IllegalArgumentException.class) public void testInvalidEmptySubTag() { AcceptableLanguage.valueOf("en-"); }
@Test(expected = IllegalArgumentException.class) public void testPrimaryTagWithInvalidChars() { AcceptableLanguage.valueOf("en12"); }
@Test(expected = IllegalArgumentException.class) public void testPrimayTagWithInvalidLength() { AcceptableLanguage.valueOf("azertyuio"); }
@Test(expected = IllegalArgumentException.class) public void testSubTagWithInvalidChars() { AcceptableLanguage.valueOf("en-US12"); }
@Test(expected = IllegalArgumentException.class) public void testSubTagWithInvalidLength() { AcceptableLanguage.valueOf("en-azertyuio"); }