private void verifyPublicAccessLogEntryForRequestHeaders(String logEntry, HttpHeaders headers, HttpMethod httpMethod,
      boolean expected) {
    Iterator<Map.Entry<String, String>> itr = headers.iteratorAsString();
    while (itr.hasNext()) {
      Map.Entry<String, String> entry = itr.next();
      if (!entry.getKey().startsWith(NOT_LOGGED_HEADER_KEY) && !entry.getKey()
          .startsWith(EchoMethodHandler.RESPONSE_HEADER_KEY_PREFIX)) {
        if (httpMethod == HttpMethod.GET && !entry.getKey().equalsIgnoreCase(HttpHeaderNames.CONTENT_TYPE.toString())) {
          String subString = "[" + entry.getKey() + "=" + entry.getValue() + "]";
          boolean actual = logEntry.contains(subString);
          if (expected) {
            Assert.assertTrue("Public Access log entry does not have expected header " + entry.getKey(), actual);
          } else {
            Assert.assertFalse("Public Access log entry has unexpected header " + entry.getKey(), actual);
          }
        }
      }
    }
  }
Verifies either the expected request headers are found or not found (based on the parameter passed) in the
public access log entry
@param logEntry the public access log entry
@param headers expected headers
@param httpMethod HttpMethod type
@param expected, true if the headers are expected, false otherwise
ambry-rest/src/test/java/com/github/ambry/rest/PublicAccessLogHandlerTest.java