### Question:
MediaType implements AcceptPredicate<MediaType> { @Override public double qualityFactor() { String q = parameters.get(AcceptPredicate.QUALITY_FACTOR_PARAMETER); return q == null ? 1D : Double.valueOf(q); } private  MediaType(String type, String subtype); private  MediaType(Builder builder); static MediaType create(String type, String subtype); static MediaType parse(String input); static Builder builder(); String type(); boolean isWildcardType(); String subtype(); boolean isWildcardSubtype(); Map<String, String> parameters(); MediaType withCharset(String charset); Optional<String> charset(); @Override double qualityFactor(); @Override boolean test(MediaType other); @SuppressWarnings("UnnecessaryJavaDocLink") @Override boolean equals(Object obj); @SuppressWarnings("UnnecessaryJavaDocLink") @Override int hashCode(); @Override String toString(); boolean hasSuffix(String suffix); static final String CHARSET_PARAMETER; static final MediaType WILDCARD; static final MediaType APPLICATION_XML; static final MediaType APPLICATION_ATOM_XML; static final MediaType APPLICATION_XHTML_XML; static final MediaType APPLICATION_SVG_XML; static final MediaType APPLICATION_JSON; static final MediaType APPLICATION_STREAM_JSON; static final MediaType APPLICATION_FORM_URLENCODED; static final MediaType MULTIPART_FORM_DATA; static final MediaType APPLICATION_OCTET_STREAM; static final MediaType TEXT_PLAIN; static final MediaType TEXT_XML; static final MediaType TEXT_HTML; static final MediaType APPLICATION_OPENAPI_YAML; static final MediaType APPLICATION_OPENAPI_JSON; static final MediaType APPLICATION_X_YAML; static final MediaType APPLICATION_YAML; static final MediaType TEXT_X_YAML; static final MediaType TEXT_YAML; static final MediaType APPLICATION_JAVASCRIPT; static final Predicate<MediaType> XML_PREDICATE; static final Predicate<MediaType> JSON_PREDICATE; }### Answer:
@Test void qualityFactor() { MediaType mediaType = MediaType.parse("unknown-type/unknown-subtype; q=0.2"); assertThat(mediaType.qualityFactor(), closeTo(0.2, 0.000001)); }