### Question:
WildcardNegotiator implements ContentNegotiator { public boolean shouldCall(Map<String, String> negotiations, Request request) { Multimap<String, String> headers = request.headers(); for (Map.Entry<String, String> negotiate : negotiations.entrySet()) { Collection<String> collectionOfHeader = headers.get(negotiate.getKey()); if (null == collectionOfHeader) continue; Iterator<String> headerValues = collectionOfHeader.iterator(); boolean shouldFire = false; List<String> matches = Arrays.asList(negotiate.getValue().split(",[ ]*")); HashMultimap<String,String> mediaMatches = createMultimatch(matches); while (headerValues.hasNext()) { String value = headerValues.next(); List<String> values = Arrays.asList(value.split(",[ ]*")); HashMultimap<String,String> mediaValues = createMultimatch(values); if (!mediaMatches.isEmpty()) { Set<String> typeIntersection = Sets.intersection(mediaMatches.keySet(), mediaValues.keySet()); if (typeIntersection.isEmpty()) { shouldFire |= typeIntersection.isEmpty(); } else { for (String mediaType: typeIntersection) { Set<String> subtypeMatches = mediaMatches.get(mediaType); Set<String> subtypeValues = mediaValues.get(mediaType); shouldFire |= (subtypeMatches.contains("*") || subtypeValues.contains("*") || !Sets.intersection(subtypeMatches, subtypeValues).isEmpty()); } } } else { shouldFire |= !(Collections.disjoint(Arrays.asList(value.split(",[ ]*")), matches)); } } if (!shouldFire) { return false; } } return true; }  boolean shouldCall(Map<String, String> negotiations, Request request);  }### Answer:
@Test(dataProvider = HEADERS_AND_NEGOTIATIONS) public final void variousHeadersAndNegotiations(Map<String, String> negotiations, final Multimap<String, String> headers, boolean shouldPass) { HttpServletRequest request = new HttpServletRequestWrapper(createMock(HttpServletRequest.class)) { @Override public Enumeration getHeaders(String name) { return Iterators.asEnumeration(headers.get(name).iterator()); } @Override public Enumeration getHeaderNames() { return Iterators.asEnumeration(headers.keys().iterator()); } }; assert shouldPass == new WildcardNegotiator().shouldCall(negotiations, TestRequestCreator.from( request, null)); }