Community extends DSpaceObject implements DSpaceObjectLegacySupport { @Override public boolean equals(Object other) { if (other == null) { return false; } Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(other); if (this.getClass() != objClass) { return false; } final Community otherCommunity = (Community) other; if (!this.getID().equals(otherCommunity.getID() )) { return false; } return true; } 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 testFindAll() throws Exception { List<Community> all = communityService.findAll(context); assertThat("testFindAll 0", all, notNullValue()); assertTrue("testFindAll 1", all.size() >= 1); boolean added = false; for(Community cm: all) { if(cm.equals(c)) { added = true; } } assertTrue("testFindAll 2",added); }
@Test public void testFindAllTop() throws Exception { List<Community> all = communityService.findAllTop(context); assertThat("testFindAllTop 0", all, notNullValue()); assertTrue("testFindAllTop 1", all.size() >= 1); for(Community cm: all) { assertThat("testFindAllTop for", communityService.getAllParents(context, cm).size(), equalTo(0)); } boolean added = false; for(Community cm: all) { if(cm.equals(c)) { added = true; } } assertTrue("testFindAllTop 2",added); }
@Test @SuppressWarnings("ObjectEqualsNull") public void testEquals() throws SQLException, AuthorizeException { new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.isAdmin((Context) any); result = true; }}; assertFalse("testEquals 0",c.equals(null)); assertFalse("testEquals 1",c.equals(communityService.create(null, context))); assertTrue("testEquals 2", c.equals(c)); }