### Question:
RegexNegotiator 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(); String match = negotiate.getValue(); boolean shouldFire = false; while (headerValues.hasNext()) { String value = headerValues.next(); shouldFire |= value.matches(match); for (String val: value.split(",[ ]*")) { shouldFire |= val.matches(match); } } 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 RegexNegotiator().shouldCall(negotiations, TestRequestCreator.from( request, null)); }