private void undeleteBlobAndVerify(String blobId, JSONObject expectedHeaders, ByteBuffer expectedContent,
      Account expectedAccount, Container expectedContainer, boolean attachPreconditions,
      RestServiceErrorCode expectedErrorCode) throws Exception {
    JSONObject headers = new JSONObject();
    if (attachPreconditions) {
      setAccountAndContainerHeaders(headers, expectedAccount.getName(), expectedContainer.getName());
    }
    headers.put(RestUtils.Headers.BLOB_ID, blobId);
    headers.put(RestUtils.Headers.SERVICE_ID, "undeleteBlobAndVerify");
    RestRequest restRequest = createRestRequest(RestMethod.PUT, "/" + Operations.UNDELETE, headers, null);
    if (expectedErrorCode != null) {
      verifyOperationFailure(restRequest, expectedErrorCode);
    } else {
      verifyUndeleteOK(restRequest);
      verifyOperationsAfterUndelete(blobId, expectedHeaders, expectedContent, expectedAccount, expectedContainer);
    }
  }
Undeletes the blob with blob ID {@code blobId} and verifies the response returned. Also checks responses from
GET, HEAD.
@param blobId the blob ID of the blob to undelete.
@param expectedHeaders the expected headers in the GET response triggered for verification (if right options are
                       provided).
@param expectedContent the expected account in the GET response triggered for verification (if right options are
                       provided). Also used to attach preconditions if required.
@param expectedAccount the expected container in the GET response triggered for verification (if right options are
                       provided). Also used to attach preconditions if required.
@param expectedContainer the {@link Container} details that are eventually expected to be populated.
@param attachPreconditions if {@code true}, attaches preconditions to the request
@param expectedErrorCode the expected {@link RestServiceErrorCode}. Null when the request should have a 200 response.
@throws Exception
ambry-frontend/src/test/java/com/github/ambry/frontend/FrontendRestRequestServiceTest.java