@Test @Rollback(false) @Transactional public void testDelete() { userService.delete("testuser"); }
@Transactional @Override public void delete(String username) { User user = findOne(username); if (user.isAdmin() && userRepository.countActiveAdminOtherThanMe(username) == 0) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8106); throw new BusinessException(messages); } userRepository.delete(user); }
UserServiceImpl implements UserService { @Transactional @Override public void delete(String username) { User user = findOne(username); if (user.isAdmin() && userRepository.countActiveAdminOtherThanMe(username) == 0) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8106); throw new BusinessException(messages); } userRepository.delete(user); } }
UserServiceImpl implements UserService { @Transactional @Override public void delete(String username) { User user = findOne(username); if (user.isAdmin() && userRepository.countActiveAdminOtherThanMe(username) == 0) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8106); throw new BusinessException(messages); } userRepository.delete(user); }  }
UserServiceImpl implements UserService { @Transactional @Override public void delete(String username) { User user = findOne(username); if (user.isAdmin() && userRepository.countActiveAdminOtherThanMe(username) == 0) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8106); throw new BusinessException(messages); } userRepository.delete(user); }  @Override User findOne(String username); @Override User findOneByUsernameOrEmail(String usernameOrEmail); @Override Page<User> findPage(Pageable pageable); @Transactional @Override User create(User user, String rawPassword); @Transactional @Override User update(String username, User updatedUser,
                       String updatedRawPassword); @Transactional @Override User updateWithoutPassword(String username, User updatedUser); @Transactional @Override void delete(String username); }
UserServiceImpl implements UserService { @Transactional @Override public void delete(String username) { User user = findOne(username); if (user.isAdmin() && userRepository.countActiveAdminOtherThanMe(username) == 0) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8106); throw new BusinessException(messages); } userRepository.delete(user); }  @Override User findOne(String username); @Override User findOneByUsernameOrEmail(String usernameOrEmail); @Override Page<User> findPage(Pageable pageable); @Transactional @Override User create(User user, String rawPassword); @Transactional @Override User update(String username, User updatedUser,
                       String updatedRawPassword); @Transactional @Override User updateWithoutPassword(String username, User updatedUser); @Transactional @Override void delete(String username);  }