### Question:
UserDeleteService { @Validated @UseCaseAdministratorDeletesUser( @Step( number = 2, name = "Service deletes user.", next = { 3, 4 }, description = "The service will delete the user with dependencies and triggers asynchronous events")) @Transactional public void deleteUser(String userId) { auditLogService.log("Triggers delete of user {}",logSanitizer.sanitize(userId,30)); assertion.isValidUserId(userId); if (userId.contentEquals(userContext.getUserId())) { throw new NotAcceptableException("You are not allowed to delete yourself!"); } User user = userRepository.findOrFailUser(userId); UserMessage message = new UserMessage(); message.setUserId(user.getName()); message.setEmailAdress(user.getEmailAdress()); userRepository.deleteUserWithAssociations(user.getName()); informUserDeleted(message); }  @Validated @UseCaseAdministratorDeletesUser( @Step( number = 2, name = "Service deletes user.", next = { 3, 4 }, description = "The service will delete the user with dependencies and triggers asynchronous events")) /* @formatter:on */ @Transactional void deleteUser(String userId);  }### Answer:
@Test public void it_its_not_allowed_to_delete_yourself() { expected.expect(NotAcceptableException.class); when(userContext.getUserId()).thenReturn(ADMIN_HIMSELF); when(userRepository.findOrFailUser(ADMIN_HIMSELF)).thenReturn(null); serviceToTest.deleteUser(ADMIN_HIMSELF); }
@Test public void it_is_allowed_to_delete_another_user() { User otherUser = new User(); otherUser.name=OTHER_USER; when(userContext.getUserId()).thenReturn(ADMIN_HIMSELF); when(userRepository.findOrFailUser(OTHER_USER)).thenReturn(otherUser); serviceToTest.deleteUser(OTHER_USER); }