//TODO this should return a list of what?
@Test
  public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException {
    DiscoveryInformation info = createMockInfo();
    HttpSession session = createMockSession(info, false, false, false);
    HttpServletRequest req = createMockRequest(session);
    AuthRequest authRequest = createMockAuthRequest();
    AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(),
            false, false);
    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));
    verify(authSuccess);
    verify(session);
  }
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);
@Test
public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException {
DiscoveryInformation info = createMockInfo();
HttpSession session = createMockSession(info, false, false, false);
HttpServletRequest req = createMockRequest(session);
AuthRequest authRequest = createMockAuthRequest();
AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(),
false, false);
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));
verify(authSuccess);
verify(session);
}
@Test
public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException {
DiscoveryInformation info = createMockInfo();
HttpSession session = createMockSession(info, false, false, false);
HttpServletRequest req = createMockRequest(session);
AuthRequest authRequest = createMockAuthRequest();
AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(),
false, false);
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));
verify(authSuccess);
verify(session);
}