### Question:
ContentNegotiationUtils { static Weighted<Language> acceptLanguage(final String header) { return Weighted.fromString(header,new LanguageParser()); } private  ContentNegotiationUtils();   }### Answer:
@Test public void acceptLanguageDoesNotAllowParametersAfterQualityDefinition() { try { acceptLanguage("en-US;q=0.000;param=value"); fail("acceptLanguage should fail when parameters are found after quality definition"); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(),equalTo("Content after quality definition is not allowed (;param=value)")); } }
@Test public void dependsOnLanguagesClassForCreatingWeightedMediaTypes() { final String value = "en-US"; new MockUp<Languages>() { @Mock public Language fromString(Invocation context, String aValue) { assertThat(aValue,equalTo(value)); return context.proceed(aValue); } }; final Weighted<Language> result=ContentNegotiationUtils.acceptLanguage(value); assertThat(result.entity().primaryTag(),equalTo("en")); assertThat(result.entity().subTag(),equalTo("US")); assertThat(result.hasWeight(),equalTo(false)); assertThat(result.weight(),equalTo(1.0D)); }