@Test public void testDirectClient() throws RequiresHttpAction { final MockIndirectClient client = new MockIndirectClient( TYPE, RedirectAction.redirect(LOGIN_URL), (Credentials) null, new CommonProfile()); client.setCallbackUrl(CALLBACK_URL); final MockWebContext context = MockWebContext.create(); client.redirect(context); final String redirectionUrl = context.getResponseLocation(); assertEquals(LOGIN_URL, redirectionUrl); final Credentials credentials = client.getCredentials(context); assertNull(credentials); }
@Test public void testSaveAlreadyTried() throws RequiresHttpAction { final MockIndirectClient client = new MockIndirectClient( TYPE, RedirectAction.redirect(LOGIN_URL), (Credentials) null, new CommonProfile()); client.setCallbackUrl(CALLBACK_URL); final MockWebContext context = MockWebContext.create(); client.getCredentials(context); assertEquals( "true", (String) context.getSessionAttribute( client.getName() + IndirectClient.ATTEMPTED_AUTHENTICATION_SUFFIX)); }