### Question:
Collection extends DSpaceObject { public Community[] getCommunities() throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(ourContext,"community", "SELECT community.* FROM community, community2collection WHERE " + "community.community_id=community2collection.community_id " + "AND community2collection.collection_id= ? ", getID()); List<Community> communities = new ArrayList<Community>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Community owner = (Community) ourContext.fromCache(Community.class, row.getIntColumn("community_id")); if (owner == null) { owner = new Community(ourContext, row); } communities.add(owner); Community[] parents = owner.getAllParents(); communities.addAll(Arrays.asList(parents)); } } finally { if (tri != null) { tri.close(); } } Community[] communityArray = new Community[communities.size()]; communityArray = (Community[]) communities.toArray(communityArray); return communityArray; } 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 testGetCommunities() throws Exception { assertThat("testGetCommunities 0",c.getCommunities(), notNullValue()); assertTrue("testGetCommunities 1",c.getCommunities().length == 0); }