### Question:
MarmottaHttpUtils { public static List<ContentType> parseAcceptHeader(String header) { String[] components = header.split(","); List<ContentType> contentTypes = new ArrayList<ContentType>(components.length); for(String c : components) { String mt[] = c.split(";"); String[] tst = mt[0].split("/"); if(tst.length == 2) { ContentType type = parseContentType(c); if(type != null) { contentTypes.add(type); } } } Collections.sort(contentTypes); return contentTypes; }  static List<ContentType> parseAcceptHeader(String header); static List<ContentType> parseAcceptHeaders(List<String> headers); static List<ContentType> parseStringList(Collection<String> types); static List<ContentType> parseQueryResultFormatList(Collection<? extends QueryResultFormat> types); static ContentType parseContentType(String c); static ContentType bestContentType(List<ContentType> offeredTypes, List<ContentType> requestedTypes); static ContentType performContentNegotiation(String accept, Collection<String> producedContentTypes); static ContentType performContentNegotiation(String accept, List<ContentType> producedContentTypes);  }### Answer:
@Test public void testParseAcceptHeader() throws Exception { List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeaders( ImmutableList.of( "application/n-triples;q=0.7," + " text/plain;q=0.7," + " application/rdf+xml;q=0.8," + " application/xml;q=0.8," + " text/turtle," + " application/x-turtle," + " application/trig;q=0.8," + " application/x-trig;q=0.8")); List<ContentType> offeredTypes = MarmottaHttpUtils.parseAcceptHeaders(ImmutableList.of( "application/ld+json; q=1.0", "application/x-turtle; q=1.0", "application/x-trig; q=1.0", "application/rdf+xml; q=1.0", "text/turtle; q=1.0", "text/rdf+n3; q=1.0", "application/trix; q=1.0", "application/rdf+json; q=1.0", "text/n3; q=1.0", "text/x-nquads; q=1.0")); assertEquals(new ContentType("text", "turtle", 1.0), MarmottaHttpUtils.bestContentType(offeredTypes, acceptedTypes)); }