}
}
}
public void testFindGroup() throws RepositoryException {
Group gr = null;
try {
Principal p = getTestPrincipal();
gr = userMgr.createGroup(p);
boolean found = false;
Iterator it = userMgr.findAuthorizables(pPrincipalName, null, UserManager.SEARCH_TYPE_GROUP);
while (it.hasNext() && !found) {
Group ng = (Group) it.next();
found = ng.getPrincipal().getName().equals(p.getName());
}
assertTrue("Searching for \"\" must find the created group.", found);
it = userMgr.findAuthorizables(pPrincipalName, p.getName(), UserManager.SEARCH_TYPE_GROUP);
assertTrue(it.hasNext());
Group ng = (Group) it.next();
assertEquals("Searching for principal-name must find the created group.", p.getName(), ng.getPrincipal().getName());
assertFalse("Only a single group must be found for a given principal name.", it.hasNext());
// but search users should not find anything
it = userMgr.findAuthorizables(pPrincipalName, p.getName(), UserManager.SEARCH_TYPE_USER);
assertFalse(it.hasNext());