request.setSession(session);
request.addParameter("param", "param_value");
MockHttpServletResponse response = new MockHttpServletResponse();
try {
SocialAuthenticationToken token = authSvc.getAuthToken(request, response);
fail("redirect expected, was token " + token);
} catch (SocialAuthenticationRedirectException e) {
// expect redirect to service url including token
// assertEquals(serviceUrl + "?oauth_token=" +
// oAuthToken.getValue(), e.getRedirectUrl());
}
// second phase
request = new MockHttpServletRequest(context, "GET", "/auth/foo");
request.setServerName(serverName);
request.setSession(session);
request.addParameter("code", code);
response = new MockHttpServletResponse();
SocialAuthenticationToken token = authSvc.getAuthToken(request, response);
assertNotNull(token);
assertTrue(token.getConnection() instanceof Connection);
assertFalse(token.isAuthenticated());
}