@Test public void dependsOnCharacterEncodingsClassForCreatingWeightedCharacterEncodings() throws Exception { final Charset expected=StandardCharsets.UTF_8; new MockUp<CharacterEncodings>() { @Mock public CharacterEncoding fromString(Invocation context, String aValue) { assertThat(aValue,equalTo(expected.name())); return context.proceed(aValue); } }; final Weighted<CharacterEncoding> result=acceptCharset(expected.name()); assertThat(result,not(nullValue())); assertThat(result.entity().charset(),equalTo(expected)); assertThat(result.hasWeight(),equalTo(false)); assertThat(result.weight(),equalTo(1.0D)); }
static Weighted<CharacterEncoding> acceptCharset(final String header) { return Weighted.fromString(header, new CharsetParser()); }
ContentNegotiationUtils { static Weighted<CharacterEncoding> acceptCharset(final String header) { return Weighted.fromString(header, new CharsetParser()); } }
ContentNegotiationUtils { static Weighted<CharacterEncoding> acceptCharset(final String header) { return Weighted.fromString(header, new CharsetParser()); } private  ContentNegotiationUtils(); }
ContentNegotiationUtils { static Weighted<CharacterEncoding> acceptCharset(final String header) { return Weighted.fromString(header, new CharsetParser()); } private  ContentNegotiationUtils();  }
ContentNegotiationUtils { static Weighted<CharacterEncoding> acceptCharset(final String header) { return Weighted.fromString(header, new CharsetParser()); } private  ContentNegotiationUtils();   }