@ApiOperation(value = "Delete a user", tags = { "Users" }, code = 204)
    @ApiResponses(value = {
            @ApiResponse(code = 204, message = "Indicates the user was found and  has been deleted. Response-body is intentionally empty."),
            @ApiResponse(code = 404, message = "Indicates the requested user was not found.")
    })
    @DeleteMapping("/identity/users/{userId}")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void deleteUser(@ApiParam(name = "userId") @PathVariable String userId) {
        User user = getUserFromRequest(userId);
        
        if (restApiInterceptor != null) {
            restApiInterceptor.deleteUser(user);
        }
        
        identityService.deleteUser(user.getId());
    }
@Test
    public void testDeleteUser() throws Exception {
        User savedUser = null;
        try {
            User newUser = identityService.newUser("testuser");
            newUser.setFirstName("Fred");
            newUser.setLastName("McDonald");
            newUser.setEmail("no-reply@flowable.org");
            identityService.saveUser(newUser);
            savedUser = newUser;

            closeResponse(executeRequest(new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())), HttpStatus.SC_NO_CONTENT));

            // Check if user is deleted
            assertThat(identityService.createUserQuery().userId(newUser.getId()).count()).isZero();
            savedUser = null;

        } finally {

            // Delete user after test fails
            if (savedUser != null) {
                identityService.deleteUser(savedUser.getId());
            }
        }
    }