private RestRequest createRestRequest(RestMethod restMethod, String uri, JSONObject headers)
      throws JSONException, UnsupportedEncodingException, URISyntaxException, RestServiceException {
    JSONObject request = new JSONObject();
    request.put(MockRestRequest.REST_METHOD_KEY, restMethod.name());
    request.put(MockRestRequest.URI_KEY, uri);
    if (headers != null) {
      request.put(MockRestRequest.HEADERS_KEY, headers);
    }
    RestRequest restRequest = new MockRestRequest(request, null);
    restRequest.setArg(RestUtils.InternalKeys.REQUEST_PATH,
        RequestPath.parse(restRequest, FRONTEND_CONFIG.pathPrefixesToRemove, CLUSTER_NAME));
    return restRequest;
  }
Method to easily create {@link RestRequest} objects containing a specific request.
@param restMethod the {@link RestMethod} desired.
@param uri string representation of the desired URI.
@param headers any associated headers as a {@link JSONObject}.
@return A {@link RestRequest} object that defines the request required by the input.
@throws org.json.JSONException
@throws java.io.UnsupportedEncodingException
@throws java.net.URISyntaxException
ambry-frontend/src/test/java/com/github/ambry/frontend/AmbrySecurityServiceTest.java