### Question:
RequestProtocolCompliance { public List<RequestProtocolError> requestIsFatallyNonCompliant(final HttpRequest request) { final List<RequestProtocolError> theErrors = new ArrayList<>(); RequestProtocolError anError = requestHasWeakETagAndRange(request); if (anError != null) { theErrors.add(anError); } if (!weakETagOnPutDeleteAllowed) { anError = requestHasWeekETagForPUTOrDELETEIfMatch(request); if (anError != null) { theErrors.add(anError); } } anError = requestContainsNoCacheDirectiveWithFieldName(request); if (anError != null) { theErrors.add(anError); } return theErrors; } RequestProtocolCompliance();  RequestProtocolCompliance(final boolean weakETagOnPutDeleteAllowed); List<RequestProtocolError> requestIsFatallyNonCompliant(final HttpRequest request); void makeRequestCompliant(final HttpRequest request);  }### Answer:
@Test public void testRequestWithWeakETagAndRange() throws Exception { final HttpRequest req = new BasicHttpRequest("GET", "/"); req.setHeader("Range", "bytes=0-499"); req.setHeader("If-Range", "W/\"weak\""); assertEquals(1, impl.requestIsFatallyNonCompliant(req).size()); }
@Test public void testRequestWithWeekETagForPUTOrDELETEIfMatch() throws Exception { final HttpRequest req = new BasicHttpRequest("PUT", "http: req.setHeader("If-Match", "W/\"weak\""); assertEquals(1, impl.requestIsFatallyNonCompliant(req).size()); }
@Test public void testRequestWithWeekETagForPUTOrDELETEIfMatchAllowed() throws Exception { final HttpRequest req = new BasicHttpRequest("PUT", "http: req.setHeader("If-Match", "W/\"weak\""); impl = new RequestProtocolCompliance(true); assertEquals(Arrays.asList(), impl.requestIsFatallyNonCompliant(req)); }