{
Subject subjectWithNoPrincipals = new Subject();
assertNull(AuthenticatedPrincipal.getOptionalAuthenticatedPrincipalFromSubject(subjectWithNoPrincipals));
Subject subjectWithoutAuthenticatedPrincipal = new Subject();
subjectWithoutAuthenticatedPrincipal.getPrincipals().add(new UsernamePrincipal("name1"));
assertNull("Should return null for a subject containing a principal that isn't an AuthenticatedPrincipal",
AuthenticatedPrincipal.getOptionalAuthenticatedPrincipalFromSubject(subjectWithoutAuthenticatedPrincipal));
}