### Question:
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) public ResponseEntity<Void> deleteEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); try { endpointService.deleteEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } catch (EndpointService.IllegalGeneratedEndpointRemoveException e) { throw new BadRequestException("Removing is not allowed for generated endpoint " + id); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") ResponseEntity<Endpoint> getEndpoint(String id); @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) ResponseEntity<Void> deleteEndpoint(String id); @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> addEndpointServiceClients(String id, ServiceClients serviceClients); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<Void> deleteEndpointServiceClients(String id, ServiceClients serviceClients);  }### Answer:
@Test(expected = ResourceNotFoundException.class) @WithMockUser(authorities = { "DELETE_ENDPOINT" }) public void deleteEndpointNotExist() { endpointsApiController.deleteEndpoint(NO_SUCH_ENDPOINT_ID); }
@Test(expected = BadRequestException.class) @WithMockUser(authorities = { "DELETE_ENDPOINT" }) public void deleteGeneratedEndpoint() { endpointsApiController.deleteEndpoint("10"); }
@Test @WithMockUser(authorities = { "DELETE_ENDPOINT" }) public void deleteEndpoint() { ClientType client = clientService.getLocalClient(getClientId("FI", "GOV", "M2", "SS6")); int aclCount = client.getAcl().size(); endpointsApiController.deleteEndpoint("11"); assertTrue(client.getEndpoint().stream().noneMatch(ep -> ep.getId().equals(11L))); assertTrue(client.getAcl().size() < aclCount); }