### Question:
Community extends DSpaceObject { public boolean canEditBoolean() throws java.sql.SQLException { try { canEdit(); return true; } catch (AuthorizeException e) { return false; } } 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 testCanEditBooleanAuth() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.WRITE); result = true; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = true; AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.WRITE); result = null; } }; assertTrue("testCanEditBooleanAuth 0", c.canEditBoolean()); }
@Test public void testCanEditBooleanAuth2() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.WRITE); result = false; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = true; AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.WRITE); result = null; } }; assertTrue("testCanEditBooleanAuth2 0", c.canEditBoolean()); }
@Test public void testCanEditBooleanAuth3() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.WRITE); result = true; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = false; AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.WRITE); result = null; } }; assertTrue("testCanEditBooleanAuth3 0", c.canEditBoolean()); }
@Test public void testCanEditBooleanAuth4() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.WRITE); result = false; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = false; AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.WRITE); result = null; } }; assertTrue("testCanEditBooleanAuth4 0", c.canEditBoolean()); }
@Test public void testCanEditBooleanNoAuth() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.WRITE); result = false; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = false; AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.WRITE); result = new AuthorizeException(); } }; assertFalse("testCanEditBooleanNoAuth 0", c.canEditBoolean()); }