Collection extends DSpaceObject implements DSpaceObjectLegacySupport { public List<Community> getCommunities() throws SQLException { Community[] output = communities.toArray(new Community[]{}); Arrays.sort(output, new NameAscendingComparator()); return Arrays.asList(output); } protected  Collection(); @Override String getName(); Bitstream getLogo(); Group getSubmitters(); Group getAdministrators(); Group getWorkflowStep1(); Group getWorkflowStep2(); Group getWorkflowStep3(); String getLicenseCollection(); void setLicense(Context context, String license); Item getTemplateItem(); List<Community> getCommunities(); @Override boolean equals(Object other); @Override int hashCode(); @Override int getType(); void setWorkflowGroup(Context context, int step, Group g); @Override Integer getLegacyId(); @Transient
    static final String COPYRIGHT_TEXT; @Transient
    static final String INTRODUCTORY_TEXT; @Transient
    static final String SHORT_DESCRIPTION; @Transient
    static final String SIDEBAR_TEXT; @Transient
    static final String PROVENANCE_TEXT; }
@Test public void testGetCommunities() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); communityService.setMetadataSingleValue(context, community, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY, "community 3"); this.collection.addCommunity(community); community = communityService.create(null, context); communityService.setMetadataSingleValue(context, community, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY, "community 1"); this.collection.addCommunity(community); community = communityService.create(null, context); communityService.setMetadataSingleValue(context, community, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY, "community 2"); this.collection.addCommunity(community); context.restoreAuthSystemState(); assertTrue("testGetCommunities 0",collection.getCommunities().size() == 4); assertTrue("testGetCommunities 1",collection.getCommunities().get(1).getName().equals("community 1")); assertTrue("testGetCommunities 1",collection.getCommunities().get(2).getName().equals("community 2")); assertTrue("testGetCommunities 1",collection.getCommunities().get(3).getName().equals("community 3")); }