Community extends DSpaceObject implements DSpaceObjectLegacySupport { public List<Community> getParentCommunities() { Community[] output = parentCommunities.toArray(new Community[]{}); Arrays.sort(output, new NameAscendingComparator()); return Arrays.asList(output); } 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 testGetParentCommunity() throws Exception { new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.authorizeAction((Context) any, (Community) any, Constants.ADD); result = null; authorizeService.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = true; }}; assertEquals("testGetParentCommunity 0", c.getParentCommunities().size(), 0); Community son = communityService.create(c, context); assertThat("testGetParentCommunity 1",son.getParentCommunities().size(), not(0)); assertThat("testGetParentCommunity 2", son.getParentCommunities().get(0), equalTo(c)); }