@Test
public void testDoGetAuthenticationInfo() {

  BaseAuthenticationToken baseAuthenticationToken =
      new VideographerAuthenticationToken("127.0.0.1", mock(SecurityLogger.class));
  AuthenticationInfo authenticationInfo =
      videographerRealm.doGetAuthenticationInfo(baseAuthenticationToken);
  assertEquals(baseAuthenticationToken.getCredentials(), authenticationInfo.getCredentials());
  PrincipalCollection principals = authenticationInfo.getPrincipals();
  assertEquals(2, principals.asList().size());
  Iterator iterator = principals.iterator();
  assertEquals("Videographer@127.0.0.1", iterator.next());
  Object next = iterator.next();
  assertTrue(next instanceof SecurityAssertion);
  SecurityAssertion securityAssertion = (SecurityAssertion) next;
  assertEquals(2, securityAssertion.getAttributeStatements().get(0).getAttributes().size());
  boolean claim1 = false;
  boolean claim2 = false;
  boolean claim3 = false;
  boolean claim4 = false;
  for (Attribute attribute : securityAssertion.getAttributeStatements().get(0).getAttributes()) {
    if (attribute.getName().equals("claim1")) {
      claim1 = true;
      assertEquals("value1", attribute.getValues().get(0));
    }
    if (attribute.getName().equals("claim2")) {
      claim2 = true;
      assertTrue(attribute.getValues().stream().anyMatch(v -> v.equals("value2")));
      assertTrue(attribute.getValues().stream().anyMatch(v -> v.equals("value3")));
    }
    if (attribute.getName().equals(":")) {
      claim3 = true;
    }
    if (attribute.getName().equals("bad")) {
      claim4 = true;
    }
  }
  assertTrue(claim1);
  assertTrue(claim2);
  assertFalse(claim3);
  assertFalse(claim4);
  AuthenticationInfo newAuthenticationInfo =
      videographerRealm.doGetAuthenticationInfo(baseAuthenticationToken);
  assertNotSame(authenticationInfo, newAuthenticationInfo);
}