### Question:
AmbrySecurityService implements SecurityService { @Override public void processRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; frontendMetrics.securityServiceProcessRequestRate.mark(); long startTimeMs = System.currentTimeMillis(); if (!isOpen) { exception = new RestServiceException("SecurityService is closed", RestServiceErrorCode.ServiceUnavailable); } else if (restRequest == null) { throw new IllegalArgumentException("RestRequest is null"); } frontendMetrics.securityServiceProcessRequestTimeInMs.update(System.currentTimeMillis() - startTimeMs); callback.onCompletion(null, exception); } AmbrySecurityService(FrontendConfig frontendConfig, FrontendMetrics frontendMetrics,
      UrlSigningService urlSigningService, QuotaManager quotaManager); @Override void preProcessRequest(RestRequest restRequest, Callback<Void> callback); @Override void processRequest(RestRequest restRequest, Callback<Void> callback); @Override void postProcessRequest(RestRequest restRequest, Callback<Void> callback); @Override void processResponse(RestRequest restRequest, RestResponseChannel responseChannel, BlobInfo blobInfo,
      Callback<Void> callback); @Override void close();  }### Answer:
@Test public void processRequestTest() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> securityService.preProcessRequest(null).get(), null); TestUtils.assertException(IllegalArgumentException.class, () -> securityService.processRequest(null).get(), null); TestUtils.assertException(IllegalArgumentException.class, () -> securityService.postProcessRequest(null).get(), null); RestMethod[] methods = new RestMethod[]{RestMethod.POST, RestMethod.GET, RestMethod.DELETE, RestMethod.HEAD, RestMethod.OPTIONS, RestMethod.PUT}; for (RestMethod restMethod : methods) { RestRequest restRequest = createRestRequest(restMethod, "/", null); securityService.preProcessRequest(restRequest).get(); securityService.processRequest(restRequest).get(); securityService.postProcessRequest(restRequest).get(); } for (RestUtils.SubResource subResource : RestUtils.SubResource.values()) { RestRequest restRequest = createRestRequest(RestMethod.GET, "/sampleId/" + subResource, null); Account account = InMemAccountService.UNKNOWN_ACCOUNT; insertAccountAndContainer(restRequest, account, account.getContainerById(Container.UNKNOWN_CONTAINER_ID)); securityService.preProcessRequest(restRequest).get(); securityService.processRequest(restRequest).get(); securityService.postProcessRequest(restRequest).get(); } URL_SIGNING_SERVICE_FACTORY.isRequestSigned = true; URL_SIGNING_SERVICE_FACTORY.verifySignedRequestException = new RestServiceException("Msg", RestServiceErrorCode.Unauthorized); testExceptionCasesProcessRequest(createRestRequest(RestMethod.GET, "/", null), RestServiceErrorCode.Unauthorized, false); URL_SIGNING_SERVICE_FACTORY.isRequestSigned = false; securityService.close(); for (RestMethod restMethod : methods) { testExceptionCasesProcessRequest(createRestRequest(restMethod, "/", null), RestServiceErrorCode.ServiceUnavailable, true); } }