### Question:
Collection extends DSpaceObject { public Group createAdministrators() throws SQLException, AuthorizeException { AuthorizeUtil.authorizeManageAdminGroup(ourContext, this); if (admins == null) { ourContext.turnOffAuthorisationSystem(); admins = Group.create(ourContext); ourContext.restoreAuthSystemState(); admins.setName("COLLECTION_" + getID() + "_ADMIN"); admins.update(); } AuthorizeManager.addPolicy(ourContext, this, Constants.ADMIN, admins); collectionRow.setColumn("admin", admins.getID()); modified = true; return admins; } Collection(Context context, TableRow row); static Collection find(Context context, int id); static Collection[] findAll(Context context); ItemIterator getItems(); ItemIterator getAllItems(); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); Group createWorkflowGroup(int step); void setWorkflowGroup(int step, Group g); Group getWorkflowGroup(int step); Group createSubmitters(); void removeSubmitters(); Group getSubmitters(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); String getLicense(); String getLicenseCollection(); boolean hasCustomLicense(); void setLicense(String license); Item getTemplateItem(); void createTemplateItem(); void removeTemplateItem(); void addItem(Item item); void removeItem(Item item); void update(); boolean canEditBoolean(); boolean canEditBoolean(boolean useInheritance); void canEdit(); void canEdit(boolean useInheritance); Community[] getCommunities(); @Override boolean equals(Object other); @Override int hashCode(); int getType(); static Collection[] findAuthorized(Context context, Community comm,
            int actionID); int countItems(); DSpaceObject getAdminObject(int action); @Override DSpaceObject getParentObject(); boolean epersonIsReviewer();  }### Answer:
@Test public void testCreateAdministratorsAuth() throws Exception { new NonStrictExpectations() { AuthorizeUtil authManager; { AuthorizeUtil.authorizeManageAdminGroup((Context) any, (Collection) any); result = null; } }; Group result = c.createAdministrators(); assertThat("testCreateAdministratorsAuth 0", result, notNullValue()); }
@Test(expected=AuthorizeException.class) public void testCreateAdministratorsNoAuth() throws Exception { new NonStrictExpectations() { AuthorizeUtil authManager; { AuthorizeUtil.authorizeManageAdminGroup((Context) any, (Collection) any); result = new AuthorizeException(); } }; Group result = c.createAdministrators(); fail("Exception expected"); }