assertNotNull("User with id " + uid + " must exist.", ath);
assertFalse("User with id " + uid + " must not be a group.", ath.isGroup());
}
// test for groups as well
GroupImpl gr = (GroupImpl) uMgr.createGroup(new TestPrincipal("z[x]"));
save(s);
// remember the z-folder for later removal
toRemove.add((NodeImpl) gr.getNode().getParent().getParent());
assertEquals("z[x]", gr.getID());
String expectedPath = groupsPath + "/z/" + Text.escapeIllegalJcrChars("z[") + "/" + Text.escapeIllegalJcrChars("z[x]");
assertEquals(expectedPath, gr.getNode().getPath());
Authorizable ath = uMgr.getAuthorizable(gr.getID());
assertNotNull(ath);
assertTrue(ath.isGroup());
// test if conflicting authorizables are detected.
try {
uMgr.createUser("z[x]", "z[x]");
save(s);
fail("A group \"z[x]\" already exists.");
} catch (AuthorizableExistsException e) {
// success
}
try {
uMgr.createGroup(new TestPrincipal("z*rik"));
save(s);
fail("A user \"z*rik\" already exists");
} catch (AuthorizableExistsException e) {
// success
}