protected boolean isAnonymousAccount(Subject subject) {
        PrincipalCollection pc = subject.getPrincipals();
        return pc != null && matches(pc, anonymousAccountUsername, anonymousAccountRealmName);
    }
@Test
    public void testIsAnonymousAccount() {
        Subject subject = new SubjectAdapter() {
            @Override
            public PrincipalCollection getPrincipals() {
                return new SimplePrincipalCollection("anonymous", "iniRealm");
            }
        };
        assertTrue(policy.isAnonymousAccount(subject));
    }