UserManagerImpl extends GenericManagerImpl<User, Long> implements UserManager, UserService { @Override public User getUser(final String userId) { return userDao.get(new Long(userId)); }  @Autowired @Qualifier("passwordEncoder") void setPasswordEncoder(final PasswordEncoder passwordEncoder); @Override @Autowired void setUserDao(final UserDao userDao); @Autowired(required = false) void setMailEngine(final MailEngine mailEngine); @Autowired(required = false) void setMailMessage(final SimpleMailMessage message); @Autowired(required = false) void setPasswordTokenManager(final PasswordTokenManager passwordTokenManager); void setPasswordRecoveryTemplate(final String passwordRecoveryTemplate); void setPasswordUpdatedTemplate(final String passwordUpdatedTemplate); @Override User getUser(final String userId); @Override List<User> getUsers(); @Override User saveUser(final User user); @Override void removeUser(final User user); @Override void removeUser(final String userId); @Override User getUserByUsername(final String username); @Override List<User> search(final String searchTerm); @Override String buildRecoveryPasswordUrl(final User user, final String urlTemplate); @Override String generateRecoveryToken(final User user); @Override boolean isRecoveryTokenValid(final String username, final String token); @Override boolean isRecoveryTokenValid(final User user, final String token); @Override void sendPasswordRecoveryEmail(final String username, final String urlTemplate); @Override User updatePassword(final String username, final String currentPassword, final String recoveryToken, final String newPassword, final String applicationUrl);  }
@Test public void testGetUser() throws Exception { final User testData = new User("1"); testData.getRoles().add(new Role("user")); given(userDao.get(1L)).willReturn(testData); User user = userManager.getUser("1"); assertTrue(user != null); assert user != null; assertTrue(user.getRoles().size() == 1); }