public void loginWithEmailAddressThenSocialLogin() {
//set up services
UserService userService = new UserServiceImpl(usersConnectionRepository, validator, applicationConfig);
((UserServiceImpl) userService).setUserRepository(userRepository);
//create email account
CreateUserRequest request = getCreateUserRequest(RandomStringUtils.randomAlphabetic(8) + "@example.com");
AuthenticatedUserToken token = userService.createUser(request, Role.authenticated);
UserProfileBuilder builder = new UserProfileBuilder();
UserProfile profile = builder.setFirstName(user.getFirstName()).setLastName(user.getLastName()).setEmail(user.getEmailAddress()).setUsername("jsmith.12").build();
when(connection.fetchUserProfile()).thenReturn(profile);