protected boolean isAnonymousAccount(Subject subject) {
        PrincipalCollection pc = subject.getPrincipals();
        return pc != null && matches(pc, anonymousAccountUsername, anonymousAccountRealmName);
    }
@Test
    public void testIsAnonymousAccountWithNullPrincipals() {
        assertFalse(policy.isAnonymousAccount(new SubjectAdapter()));
    }