((UserServiceImpl)userService).setUserRepository(userRepository);
UserProfileBuilder builder = new UserProfileBuilder();
UserProfile profile = builder.setFirstName("Tom").setLastName("Tucker").setEmail("tt@example.com").setUsername("ttucker").build();
when(connection.fetchUserProfile()).thenReturn(profile);
AuthenticatedUserToken token = userService.socialLogin(connection);
ExternalUser user = userService.getUser(new ExternalUser(token.getUserId()), token.getUserId());
assertThat(user, is(notNullValue()));
assertThat(user.getEmailAddress(), is("tt@example.com"));
assertThat(user.getFirstName(), is("Tom"));
assertThat(user.getLastName(), is("Tucker"));
assertThat(user.isVerified(), is(true));
assertThat(user.getRole().equalsIgnoreCase(Role.authenticated.toString()), is(true));
}