@Test
    void testRealmWithRolePermissionResolver() {
        Principal principal = new UsernamePrincipal("rolePermResolver");
        PrincipalCollection pCollection = new SimplePrincipalCollection(principal, "testRealmWithRolePermissionResolver");

        AuthorizingRealm realm = new AllowAllRealm();
        realm.setRolePermissionResolver(new RolePermissionResolver() {
            public Collection<Permission> resolvePermissionsInRole(String roleString) {
                Collection<Permission> permissions = new HashSet<Permission>();
                if (roleString.equals(ROLE)) {
                    permissions.add(new WildcardPermission(ROLE + ":perm1"));
                    permissions.add(new WildcardPermission(ROLE + ":perm2"));
                    permissions.add(new WildcardPermission("other:*:foo"));
                }
                return permissions;
            }
        });

        assertTrue(realm.hasRole(pCollection, ROLE));
        assertTrue(realm.isPermitted(pCollection, ROLE + ":perm1"));
        assertTrue(realm.isPermitted(pCollection, ROLE + ":perm2"));
        assertFalse(realm.isPermitted(pCollection, ROLE + ":perm3"));
        assertTrue(realm.isPermitted(pCollection, "other:bar:foo"));
    }
Simple test case for AuthorizingRealm.
<p/>
TODO - this could/should be expanded to be more robust end to end test for the AuthorizingRealm
core/src/test/java/org/apache/shiro/realm/AuthorizingRealmTest.java