void verifyUserMetadata(HttpHeaders expectedHeaders, HttpResponse response, byte[] usermetadata,
      Queue<HttpObject> content, Container container) {
    if (usermetadata == null) {
      Set<String> keysToNotPrefix =
          container != null ? container.getUserMetadataKeysToNotPrefixInResponse() : Collections.emptySet();
      for (Map.Entry<String, String> header : expectedHeaders) {
        String key = header.getKey();
        if (key.startsWith(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX)) {
          String keyWithoutPrefix = key.substring(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX.length());
          if (keysToNotPrefix.contains(keyWithoutPrefix)) {
            key = keyWithoutPrefix;
          }
          assertEquals("Value for " + key + " does not match in user metadata", header.getValue(),
              response.headers().get(key));
        }
      }
      for (Map.Entry<String, String> header : response.headers()) {
        String key = header.getKey();
        if (key.startsWith(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX)) {
          assertTrue("Key " + key + " does not exist in expected headers", expectedHeaders.contains(key));
        }
        if (keysToNotPrefix.contains(key)) {
          assertTrue("Key " + key + " does not exist in expected headers",
              expectedHeaders.contains(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + key));
        }
      }
    } else {
      assertEquals("Content-Length is not as expected", usermetadata.length, HttpUtil.getContentLength(response));
      byte[] receivedMetadata = getContent(content, HttpUtil.getContentLength(response)).array();
      assertArrayEquals("User metadata does not match original", usermetadata, receivedMetadata);
    }
  }
Verifies User metadata headers from output, to that sent in during input
@param expectedHeaders the expected headers in the response.
@param response the {@link HttpResponse} which contains the headers of the response.
@param usermetadata if non-null, this is expected to come as the body.
@param content the content accompanying the response.
ambry-frontend/src/integration-test/java/com/github/ambry/frontend/FrontendIntegrationTestBase.java