UserServiceImpl implements UserService { @Override public void deleteById(int id) { User user = findById(id); if (root.equals(user.getEmail())) { throw new RuntimeException("ROOT 用户不能删除"); } userRepository.deleteById(id); userAppRepository.deleteByUserId(id); }  @Override void save(User user); @Override void save(User user, int[] appIds); @Override void update(User user); @Override void updatePassword(int id, String oldPassword, String newPassword); @Override void update(User user, int[] appIds); @Override void deleteById(int id); @Transactional(readOnly = true) @Override User findById(int id); @Transactional(readOnly = true) @Override User findByEmail(String email); @Transactional(readOnly = true) @Override int[] findUserAppIds(int id); @Override List<User> findOrdinaryUsers(); @Transactional(readOnly = true) @Override List<User> findAll(); @Transactional(readOnly = true) @Override User authenticate(String email, String password);  }
@Test(dataProvider = "dataUser") public void testDeleteById(User user) throws Exception { userService.save(user); userService.deleteById(user.getId()); }