### Question:
Community extends DSpaceObject { public static Community[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "community", "SELECT * FROM community ORDER BY name"); List<Community> communities = new ArrayList<Community>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Community fromCache = (Community) context.fromCache( Community.class, row.getIntColumn("community_id")); if (fromCache != null) { communities.add(fromCache); } else { communities.add(new Community(context, row)); } } } finally { if (tri != null) { tri.close(); } } Community[] communityArray = new Community[communities.size()]; communityArray = (Community[]) communities.toArray(communityArray); return communityArray; } Community(Context context, TableRow row); static Community find(Context context, int id); static Community create(Community parent, Context context); static Community create(Community parent, Context context, String handle); static Community[] findAll(Context context); static Community[] findAllTop(Context context); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); void update(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); Collection[] getCollections(); Community[] getSubcommunities(); Community getParentCommunity(); Community[] getAllParents(); Collection createCollection(); Collection createCollection(String handle); void addCollection(Collection c); Community createSubcommunity(); Community createSubcommunity(String handle); void addSubcommunity(Community c); void removeCollection(Collection c); void removeSubcommunity(Community c); void delete(); boolean equals(Object other); int hashCode(); int getType(); boolean canEditBoolean(); void canEdit(); int countItems(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject();  }### Answer:
@Test public void testFindAll() throws Exception { Community[] all = Community.findAll(context); assertThat("testFindAll 0", all, notNullValue()); assertTrue("testFindAll 1", all.length >= 1); boolean added = false; for(Community cm: all) { if(cm.equals(c)) { added = true; } } assertTrue("testFindAll 2",added); }