### Question:
DataHubClusterDeletionHandler extends EventSenderAwareHandler<EnvironmentDeletionDto> { @Override public void accept(Event<EnvironmentDeletionDto> environmentDtoEvent) { LOGGER.debug("Accepting DataHubClustersDelete event"); EnvironmentDeletionDto environmentDeletionDto = environmentDtoEvent.getData(); EnvironmentDto environmentDto = environmentDeletionDto.getEnvironmentDto(); EnvDeleteEvent envDeleteEvent = getEnvDeleteEvent(environmentDeletionDto); try { PollingConfig pollingConfig = getPollingConfig(); environmentService.findEnvironmentById(environmentDto.getId()) .ifPresent(environment -> datahubDeletionService.deleteDatahubClustersForEnvironment( pollingConfig, environment, environmentDeletionDto.isForceDelete())); eventSender().sendEvent(envDeleteEvent, environmentDtoEvent.getHeaders()); } catch (Exception e) { EnvClusterDeleteFailedEvent failedEvent = EnvClusterDeleteFailedEvent.builder() .withEnvironmentID(environmentDto.getId()) .withException(e) .withResourceCrn(environmentDto.getResourceCrn()) .withResourceName(environmentDto.getName()) .build(); eventSender().sendEvent(failedEvent, environmentDtoEvent.getHeaders()); } } protected  DataHubClusterDeletionHandler(EventSender eventSender, EnvironmentService environmentService, DatahubDeletionService datahubDeletionService); @Override void accept(Event<EnvironmentDeletionDto> environmentDtoEvent); @Override String selector();  }### Answer:
@Test void accept() { Environment environment = new Environment(); when(environmentService.findEnvironmentById(ENV_ID)).thenReturn(Optional.of(environment)); underTest.accept(environmentDtoEvent); verify(datahubDeletionService).deleteDatahubClustersForEnvironment(any(PollingConfig.class), eq(environment), eq(false)); verify(eventSender).sendEvent(any(EnvDeleteEvent.class), eq(headers)); verify(eventSender, never()).sendEvent(any(EnvClusterDeleteFailedEvent.class), any()); EnvDeleteEvent capturedDeleteEvent = (EnvDeleteEvent) baseNamedFlowEvent.getValue(); assertThat(capturedDeleteEvent.getResourceName()).isEqualTo(ENV_NAME); assertThat(capturedDeleteEvent.getResourceId()).isEqualTo(ENV_ID); assertThat(capturedDeleteEvent.getResourceCrn()).isEqualTo(RESOURCE_CRN); assertThat(capturedDeleteEvent.selector()).isEqualTo("START_DATALAKE_CLUSTERS_DELETE_EVENT"); }