@Test
public void testAuthenticateUserDetails() throws Exception {
SAMLMessageContext context = new SAMLMessageContext();
context.setCommunicationProfileId(SAMLConstants.SAML2_WEBSSO_PROFILE_URI);
SAMLUserDetailsService details = createMock(SAMLUserDetailsService.class);
provider.setUserDetails(details);
SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
SAMLCredential result = new SAMLCredential(nameID, assertion, "IDP", "localSP");
expect(consumer.processAuthenticationResponse(context)).andReturn(result);
expect(assertion.getAuthnStatements()).andReturn(new LinkedList<AuthnStatement>());
User user = new User("test", "test", true, true, true, true, Arrays.asList(new SimpleGrantedAuthority("role1"), new SimpleGrantedAuthority("role2")));
expect(details.loadUserBySAML(result)).andReturn(user);
provider.setForcePrincipalAsString(false);
replayMock();
replay(details);