assertTrue(engine.listUsers().isEmpty());
engine.addUser("abc", "xyz");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).isEmpty());
assertTrue(engine.listRoles(new GroupPrincipal("group1")).isEmpty());
assertTrue(engine.listGroups(new UserPrincipal("abc")).isEmpty());
engine.addRole("abc", "role1");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role1")));
assertTrue(engine.listRoles(new GroupPrincipal("group1")).isEmpty());
assertTrue(engine.listGroups(new UserPrincipal("abc")).isEmpty());
engine.addGroupRole("group1", "role2");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role1")));
assertTrue(engine.listRoles(new GroupPrincipal("group1")).contains(new RolePrincipal("role2")));
assertTrue(engine.listGroups(new UserPrincipal("abc")).isEmpty());
engine.addGroup("abc", "group1");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role1")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role2")));
assertTrue(engine.listRoles(new GroupPrincipal("group1")).contains(new RolePrincipal("role2")));
assertTrue(engine.listGroups(new UserPrincipal("abc")).contains(new GroupPrincipal("group1")));
engine.deleteRole("abc", "role1");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role2")));
assertTrue(engine.listRoles(new GroupPrincipal("group1")).contains(new RolePrincipal("role2")));
assertTrue(engine.listGroups(new UserPrincipal("abc")).contains(new GroupPrincipal("group1")));
engine.deleteGroupRole("group1", "role2");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).isEmpty());
assertTrue(engine.listRoles(new GroupPrincipal("group1")).isEmpty());
assertTrue(engine.listGroups(new UserPrincipal("abc")).contains(new GroupPrincipal("group1")));
engine.addGroupRole("group1", "role3");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).contains(new RolePrincipal("role3")));
assertTrue(engine.listRoles(new GroupPrincipal("group1")).contains(new RolePrincipal("role3")));
assertTrue(engine.listGroups(new UserPrincipal("abc")).contains(new GroupPrincipal("group1")));
engine.deleteGroup("abc", "group1");
assertTrue(engine.listUsers().contains(new UserPrincipal("abc")));
assertTrue(engine.listRoles(new UserPrincipal("abc")).isEmpty());
assertTrue(engine.listRoles(new GroupPrincipal("group1")).isEmpty());
assertTrue(engine.listGroups(new UserPrincipal("abc")).isEmpty());
engine.deleteUser("abc");
assertTrue(engine.listUsers().isEmpty());
assertTrue(engine.listRoles(new UserPrincipal("abc")).isEmpty());
assertTrue(engine.listRoles(new GroupPrincipal("group1")).isEmpty());
assertTrue(engine.listGroups(new UserPrincipal("abc")).isEmpty());
}