### Question:
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public List<MediaType> acceptedTypes() { List<MediaType> result = this.acceptedtypesCache; if (result == null) { List<String> acceptValues = all(Http.Header.ACCEPT); if (acceptValues.size() == 1 && HUC_ACCEPT_DEFAULT.equals(acceptValues.get(0))) { result = HUC_ACCEPT_DEFAULT_TYPES; } else { result = LazyList.create(acceptValues.stream() .flatMap(h -> Utils.tokenize(',', "\"", false, h).stream()) .map(String::trim) .map(s -> LazyValue.create(() -> MediaType.parse(s))) .collect(Collectors.toList())); } result = Collections.unmodifiableList(result); this.acceptedtypesCache = result; } return result; } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); @Override Optional<MediaType> contentType(); @Override OptionalLong contentLength(); @Override Parameters cookies(); @Override List<MediaType> acceptedTypes(); @Override boolean isAccepted(MediaType mediaType); @Override Optional<MediaType> bestAccepted(MediaType... mediaTypes); @Override Optional<ZonedDateTime> acceptDatetime(); @Override Optional<ZonedDateTime> date(); @Override Optional<ZonedDateTime> ifModifiedSince(); @Override Optional<ZonedDateTime> ifUnmodifiedSince(); @Override Optional<URI> referer();  }### Answer:
@Test public void acceptedTypes() { HashRequestHeaders hs = withHeader(Http.Header.ACCEPT, "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4"); assertThat(hs.acceptedTypes().size(), is(4)); assertThat(hs.acceptedTypes().get(0), is(createMt("text", "*", Map.of("q", "0.3")))); assertThat(hs.acceptedTypes().get(0).qualityFactor(), IsCloseTo.closeTo(0, 0.3)); assertThat(hs.acceptedTypes().get(1), is(createMt("text", "html", Map.of("q", "0.7")))); assertThat(hs.acceptedTypes().get(2), is(createMt("text", "html", Map.of("level", "1")))); assertThat(hs.acceptedTypes().get(3), is(createMt("text", "html", Map.of("level", "2", "q", "0.4")))); }
@Test public void hucDefaultAccept(){ try { HashRequestHeaders hs = withHeader(Http.Header.ACCEPT, HashRequestHeaders.HUC_ACCEPT_DEFAULT); assertThat(hs.acceptedTypes().get(0), is(MediaType.TEXT_HTML)); assertThat(hs.acceptedTypes().get(1), is(createMt("image", "gif"))); assertThat(hs.acceptedTypes().get(2), is(createMt("image", "jpeg"))); assertThat(hs.acceptedTypes().get(3), is(createMt("*", "*", Map.of("q", ".2")))); } catch(IllegalStateException ex){ Assertions.fail(ex.getMessage(), ex); } }