Set groups = subject.getPrincipals(Group.class);
Set principals = subject.getPrincipals();
assertTrue("Principals contains Java Duke", principals.contains(new SimplePrincipal("Java Duke")));
assertTrue("Principals contains Roles", groups.contains(new SimplePrincipal("Roles")));
Group roles = (Group) groups.iterator().next();
assertTrue("RG2 is a role", roles.isMember(new SimplePrincipal("RG2")));
assertTrue("R1 is a role", roles.isMember(new SimplePrincipal("R1")));
assertTrue("R2 is a role", roles.isMember(new SimplePrincipal("R2")));
assertTrue("R3 is a role", roles.isMember(new SimplePrincipal("R3")));
assertFalse("R4 is NOT a role", roles.isMember(new SimplePrincipal("R4")));
assertTrue("R5 is a role", roles.isMember(new SimplePrincipal("R5")));
lc.logout();
}