### Question:
UserServiceImpl implements UserService { @Override public User addUser(String nickname, String email, String password) { if (userRepository.existsByEmail(email)) { throw new UserExistsException("User email=" + email + " already exists"); } else if (userRepository.existsByNickname(nickname)) { throw new UserExistsException("User nickname=" + nickname + " already exists"); } else if (password == null || password.equals("")) { throw new IllegalArgumentException(); } else { User user = new User(); user.setNickname(nickname); user.setEmail(email); user.setPassword(password); userRepository.save(user); return user; } } @Autowired  UserServiceImpl(UserRepository userRepository); @Override List<User> getUsers(); @Override User getUser(long id); @Override User addUser(String nickname, String email, String password);  }### Answer:
@Test public void addUser() throws UserExistsException { User expected = new User(3L, "user3", "user3@mail.com", "demo"); User actual = userService.addUser(expected.getNickname(), expected.getEmail(), expected.getPassword()); userRepository.deleteById(3L); assertEquals(expected, actual); }