### Question:
HttpHeadersImpl implements HttpHeaders { public List<MediaType> getAcceptableMediaTypes() { List<String> lValues = headers.get(HttpHeaders.ACCEPT); if (lValues == null || lValues.isEmpty() || lValues.get(0) == null) { return Collections.singletonList(MediaType.WILDCARD_TYPE); } List<MediaType> mediaTypes = new LinkedList<>(); for (String value : lValues) { mediaTypes.addAll(JAXRSUtils.parseMediaTypes(value)); } sortMediaTypesUsingQualityFactor(mediaTypes); return mediaTypes; } HttpHeadersImpl(Message message); List<MediaType> getAcceptableMediaTypes(); Map<String, Cookie> getCookies(); Locale getLanguage(); MediaType getMediaType(); MultivaluedMap<String, String> getRequestHeaders(); List<Locale> getAcceptableLanguages(); List<String> getRequestHeader(String name); Date getDate(); String getHeaderString(String headerName); int getLength();  }### Answer:
@Test public void testGetMediaTypes() throws Exception { Message m = createMessage(createHeaders()); HttpHeaders h = new HttpHeadersImpl(m); List<MediaType> acceptValues = h.getAcceptableMediaTypes(); assertEquals(3, acceptValues.size()); assertEquals("text/*;q=1", acceptValues.get(0).toString()); assertEquals("application/xml", acceptValues.get(1).toString()); assertEquals("text/bar;q=0.6", acceptValues.get(2).toString()); }
@Test public void testGetNoMediaTypes() throws Exception { Message m = new MessageImpl(); m.put(Message.PROTOCOL_HEADERS, Collections.emptyMap()); HttpHeaders h = new HttpHeadersImpl(m); List<MediaType> acceptValues = h.getAcceptableMediaTypes(); assertEquals(1, acceptValues.size()); assertEquals("*/*", acceptValues.get(0).toString()); }