@Test
  public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException {
    DiscoveryInformation info = createMockInfo();
    HttpSession session = createMockSession(info, true, true, true);
    HttpServletRequest req = createMockRequest(session);
    AuthRequest authRequest = createMockAuthRequest();
    AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(),
            true, true);
    Identifier id = createMockIdentifier();
    VerificationResult result = createMockVerificationResult(id, authSuccess);
    //TODO this should return a list of what?
    expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList());
    expect(mockManager.associate(anyObject(List.class))).andReturn(info);
    expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest);
    expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result);
    replay(mockManager);
    consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority);
    assertEquals(id, consumer.verifyResponse(req));
  }
@Test
  public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException {
    DiscoveryInformation info = createMockInfo();
    HttpSession session = createMockSession(info, true, true, true);
    HttpServletRequest req = createMockRequest(session);
    AuthRequest authRequest = createMockAuthRequest();
    AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(),
            true, true);
    Identifier id = createMockIdentifier();
    VerificationResult result = createMockVerificationResult(id, authSuccess);
   
    expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList());
    expect(mockManager.associate(anyObject(List.class))).andReturn(info);
    expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest);
    expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result);
    replay(mockManager);
    consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority);
    assertEquals(id, consumer.verifyResponse(req));
  }
@test public void testverifyresponse() throws ioexception, messageexception, discoveryexception, consumerexception, associationexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, true, true, true); httpservletrequest req = createmockrequest(session); authrequest authrequest = createmockauthrequest(); authsuccess authsuccess = createmockauthsuccess(createmockfetchresponse(), createregresponse(), true, true); identifier id = createmockidentifier(); verificationresult result = createmockverificationresult(id, authsuccess); expect(mockmanager.discover(eq("discover"))).andreturn(lists.newarraylist()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); expect(mockmanager.verify(eq("http://example.com/request?query"), anyobject(parameterlist.class), anyobject(discoveryinformation.class))).andreturn(result); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertequals(id, consumer.verifyresponse(req)); }