### Question:
UserService extends BaseService { @Transactional(readOnly = false) public void updateUser(User user, String plainPassword) { if (StringUtils.isNotBlank(plainPassword)) { entryptPassword(user, plainPassword); } userRepository.save(user); }  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 updateUser() { User user = UserData.randomNewUser(); userService.updateUser(user, UserData.randomPassword()); assertNotNull(user.getSalt()); User user2 = UserData.randomNewUser(); userService.updateUser(user2, null); assertNull(user2.getSalt()); }