### Question:
UserService extends BaseService { @Transactional(readOnly = false) public void deleteUser(Long id) { if (isSupervisor(id)) { logger.warn("操作员{}尝试删除超级管理员用户", getCurrentUserName()); throw new ServiceException("不能删除超级管理员用户"); } userRepository.delete(id); }  User getUser(Long id); User findUserByLoginName(String loginName); User findUserByEmail(String email); @Transactional(readOnly = false) void registerUser(User user, String plainPassword); @Transactional(readOnly = false) void createUser(User user, String plainPassword); @Transactional(readOnly = false) void updateUser(User user, String plainPassword); @Transactional(readOnly = false) void updatePassword(User user, String plainPassword); @Transactional(readOnly = false) void deleteUser(Long id); @Transactional(readOnly = false) void activeUser(Long id); @Transactional(readOnly = false) void deactiveUser(Long id); Page<User> getUsers(Map<String, Object> searchParams, int pageNumber, int pageSize, String sortType); @Transactional(readOnly = false) void activeUser(String key); void sendResetPwdEmail(User user); @Transactional(readOnly = false) void resetPassword(String key); static final String HASH_ALGORITHM; static final int HASH_INTERATIONS; }### Answer:
@Test public void deleteUser() { userService.deleteUser(2L); Mockito.verify(mockUserDao).delete(2L); try { userService.deleteUser(1L); fail("expected ServicExcepton not be thrown"); } catch (ServiceException e) { } Mockito.verify(mockUserDao, Mockito.never()).delete(1L); }