UserServiceImpl extends WaspServiceImpl implements UserService { @Override public String getNewAuthcodeForUserPending(UserPending userpending) { String authcode = AuthCode.create(20); ConfirmEmailAuth confirmEmailAuth = confirmEmailAuthDao.getConfirmEmailAuthByUserpendingId(userpending.getUserPendingId()); confirmEmailAuth.setAuthcode(authcode); confirmEmailAuth.setUserpendingId(userpending.getUserPendingId()); confirmEmailAuthDao.save(confirmEmailAuth); return authcode; }  @Override @Autowired void setUserDao(UserDao userDao); @Override UserDao getUserDao(); void setconfirmEmailAuthDao(ConfirmEmailAuthDao confirmEmailAuthDao); @Override String getUniqueLoginName(final User user); @Override String getNewAuthcodeForUser(User user); @Override String getNewAuthcodeForUserPending(UserPending userpending); @Override void reverseSortUsersByUserId(List<User> users); @Override List<User> getFacilityTechnicians(); @Override User getUserByLogin(String login); @Override User getUserByEmail(String emailAddress); @Override List<User> getFacilityManagers(); @Override UserMetaDao getUserMetaDao(); @Override List<Lab> getLabsForUser(User user);  }
@Test public void getNewAuthcodeForUserPending() { UserPending userPending = new UserPending(); userPending.setUserPendingId(123); userServiceImpl.setconfirmEmailAuthDao(mockConfirmEmailAuthDao); ConfirmEmailAuth confirmEmailAuth = new ConfirmEmailAuth(); expect(mockConfirmEmailAuthDao.getConfirmEmailAuthByUserpendingId(123)).andReturn(confirmEmailAuth); expect(mockConfirmEmailAuthDao.save(confirmEmailAuth)).andReturn(confirmEmailAuth); replay(mockConfirmEmailAuthDao); Assert.assertNotNull(userServiceImpl.getNewAuthcodeForUserPending(userPending)); verify(mockConfirmEmailAuthDao); }