use of org.apache.jackrabbit.api.security.user.AuthorizableExistsException in project jackrabbit-oak by apache.
the class UserManagerTest method testCreateGroupWithExistingGroupID.
@Test
public void testCreateGroupWithExistingGroupID() throws RepositoryException, NotExecutableException {
Group g = null;
try {
String id = createGroupId();
// create a user with the given ID
g = userMgr.createGroup(id);
superuser.save();
// assert AuthorizableExistsException for id that is already in use
Group gr = null;
try {
gr = userMgr.createGroup(id);
fail("ID " + id + " is already in use -> must throw AuthorizableExistsException.");
} catch (AuthorizableExistsException aee) {
// expected this
} finally {
if (gr != null) {
gr.remove();
superuser.save();
}
}
} finally {
if (g != null) {
g.remove();
superuser.save();
}
}
}
Aggregations