### Question:
DeleteHandler extends BaseHandler<CallbackContext> { @Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); }  @Override ProgressEvent<ResourceModel, CallbackContext> handleRequest(
        final AmazonWebServicesClientProxy proxy,
        final ResourceHandlerRequest<ResourceModel> request,
        final CallbackContext callbackContext,
        final Logger logger);  }### Answer:
@Test public void handleRequest_SimpleSuccess() { final DeleteHandler handler = new DeleteHandler(); doReturn(DeleteConfigurationSetResponse.builder().build()) .when(proxy) .injectCredentialsAndInvokeV2( ArgumentMatchers.any(), ArgumentMatchers.any() ); final ResourceModel model = ResourceModel.builder() .name("test-set") .build(); final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder() .desiredResourceState(model) .build(); final ProgressEvent<ResourceModel, CallbackContext> response = handler.handleRequest(proxy, request, null, logger); assertThat(response).isNotNull(); assertThat(response.getStatus()).isEqualTo(OperationStatus.SUCCESS); assertThat(response.getCallbackContext()).isNull(); assertThat(response.getResourceModel()).isNull(); assertThat(response.getResourceModels()).isNull(); assertThat(response.getMessage()).isNull(); assertThat(response.getErrorCode()).isNull(); }
@Test public void handleRequest_FailedDelete_UnknownError() { final DeleteHandler handler = new DeleteHandler(); doThrow(SdkException.builder().message("test error").build()) .when(proxy) .injectCredentialsAndInvokeV2( ArgumentMatchers.any(), ArgumentMatchers.any() ); final ResourceModel model = ResourceModel.builder() .name("test-set") .build(); final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder() .desiredResourceState(model) .build(); assertThrows(SdkException.class, () -> { handler.handleRequest(proxy, request, null, logger); }); }
@Test public void handleRequest_FailedDelete_AmazonServiceException() { final DeleteHandler handler = new DeleteHandler(); doThrow(new AmazonServiceException("test error")) .when(proxy) .injectCredentialsAndInvokeV2( ArgumentMatchers.any(), ArgumentMatchers.any() ); final ResourceModel model = ResourceModel.builder() .name("test-set") .build(); final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder() .desiredResourceState(model) .build(); assertThrows(AmazonServiceException.class, () -> { handler.handleRequest(proxy, request, null, logger); }); }
@Test public void handleRequest_NonExistingSuccess() { final DeleteHandler handler = new DeleteHandler(); doThrow(ConfigurationSetDoesNotExistException.class) .when(proxy) .injectCredentialsAndInvokeV2( ArgumentMatchers.any(), ArgumentMatchers.any() ); final ResourceModel model = ResourceModel.builder() .name("test-set") .build(); final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder() .desiredResourceState(model) .build(); assertThrows(CfnNotFoundException.class, () -> { handler.handleRequest(proxy, request, null, logger); }); }