Set groups = subject.getPrincipals(Group.class);
Set principals = subject.getPrincipals();
assertTrue("Principals contains Java Duke", principals.contains(new SimplePrincipal("jduke")));
assertTrue("Principals contains Roles", groups.contains(new SimplePrincipal("Roles")));
Group roles = (Group) groups.iterator().next();
Enumeration names = roles.members();
while( names.hasMoreElements() )
{
System.out.println(names.nextElement());
}
assertTrue("inf_map_vmware_iso_S is a role", roles.isMember(new SimplePrincipal("inf_map_vmware_iso_S")));