Community extends DSpaceObject implements DSpaceObjectLegacySupport { public Group getAdministrators() { return admins; } protected  Community(); Bitstream getLogo(); Group getAdministrators(); List<Collection> getCollections(); List<Community> getSubcommunities(); List<Community> getParentCommunities(); void removeParentCommunity(Community parentCommunity); @Override boolean equals(Object other); @Override int hashCode(); @Override int getType(); @Override String getName(); @Override Integer getLegacyId(); static final String COPYRIGHT_TEXT; static final String INTRODUCTORY_TEXT; static final String SHORT_DESCRIPTION; static final String SIDEBAR_TEXT; }
@Test public void testCreateAdministratorsAuth() throws Exception { new NonStrictExpectations(AuthorizeUtil.class) {{ AuthorizeUtil.authorizeManageAdminGroup((Context) any, (Community) any); result = null; }}; Group result = communityService.createAdministrators(context, c); assertThat("testCreateAdministratorsAuth 0",c.getAdministrators(), notNullValue()); assertThat("testCreateAdministratorsAuth 1",c.getAdministrators(), equalTo(result)); }
@Test public void testRemoveAdministratorsAuth() throws Exception { new NonStrictExpectations(AuthorizeUtil.class) {{ AuthorizeUtil.authorizeManageAdminGroup((Context) any, (Community) any); result = null; AuthorizeUtil.authorizeRemoveAdminGroup((Context) any, (Community) any); result = null; }}; Group result = communityService.createAdministrators(context, c); assertThat("testRemoveAdministratorsAuth 0",c.getAdministrators(), notNullValue()); assertThat("testRemoveAdministratorsAuth 1",c.getAdministrators(), equalTo(result)); communityService.removeAdministrators(context, c); assertThat("testRemoveAdministratorsAuth 2",c.getAdministrators(), nullValue()); }
@Test(expected=AuthorizeException.class) public void testRemoveAdministratorsNoAuth() throws Exception { new NonStrictExpectations(AuthorizeUtil.class) {{ AuthorizeUtil.authorizeManageAdminGroup((Context) any, (Community) any); result = null; AuthorizeUtil.authorizeRemoveAdminGroup((Context) any, (Community) any); result = new AuthorizeException(); }}; Group result = communityService.createAdministrators(context, c); assertThat("testRemoveAdministratorsAuth 0",c.getAdministrators(), notNullValue()); assertThat("testRemoveAdministratorsAuth 1",c.getAdministrators(), equalTo(result)); communityService.removeAdministrators(context, c); fail("Should have thrown exception"); }
@Test public void testGetAdministrators() { assertThat("testGetAdministrators 0",c.getAdministrators(), nullValue()); }