UserService { public User getUserByUsername(String username) { User currentUser = authenticationService.getCurrentUser(); String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin()); String login = DomainUtil.getLoginFromUsernameAndDomain(username, domain); return getUserByLogin(login); }  User getUserByLogin(String login); String getLoginByRssUid(String rssUid); User getUserByUsername(String username); Collection<User> getUsersByLogin(Collection<String> logins); List<User> getUsersForCurrentDomain(int pagination); void updateUser(User user); void updatePassword(User user); void createUser(User user); void createTatamibot(String domain); void deleteUser(User user); @Secured("ROLE_ADMIN") @CacheEvict(value = {"group-user-cache", "group-cache","suggest-users-cache"}, allEntries = true) boolean desactivateUser( String username ); void registerUser(User user); void lostPassword(User user); String validateRegistration(String key); void updateWeeklyDigestRegistration(boolean registration); void updateDailyDigestRegistration(boolean registration); String updateRssTimelinePreferences(boolean booleanPreferencesRssTimeline); boolean isDomainHandledByLDAP(String domain); Collection<UserDTO> buildUserDTOList(Collection<User> users); UserDTO buildUserDTO(User user);  }
@Test public void shouldGetAUserProfileByLogin() { mockAuthenticationOnUserService("jdubois@ippon.fr"); User user = userService.getUserByUsername("jdubois"); assertThat(user.getStatusCount(), is(2L)); assertThat(user.getFollowersCount(), is(3L)); assertThat(user.getFriendsCount(), is(4L)); }
@Test public void shouldNotGetAUserProfileByLogin() { User user = userService.getUserByUsername("unknownUserLogin"); assertThat(user, nullValue()); }