### Question:
Collection extends DSpaceObject { public static Collection[] findAuthorized(Context context, Community comm, int actionID) throws java.sql.SQLException { List<Collection> myResults = new ArrayList<Collection>(); Collection[] myCollections = null; if (comm != null) { myCollections = comm.getCollections(); } else { myCollections = Collection.findAll(context); } for (int i = 0; i < myCollections.length; i++) { if (AuthorizeManager.authorizeActionBoolean(context, myCollections[i], actionID)) { myResults.add(myCollections[i]); } } myCollections = new Collection[myResults.size()]; myCollections = (Collection[]) myResults.toArray(myCollections); return myCollections; } 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 testFindAuthorized() throws Exception { context.turnOffAuthorisationSystem(); Community com = Community.create(null, context); context.restoreAuthSystemState(); Collection[] found = Collection.findAuthorized(context, com, Constants.WRITE); assertThat("testFindAuthorized 0",found,notNullValue()); assertTrue("testFindAuthorized 1",found.length == 0); found = Collection.findAuthorized(context, null, Constants.WRITE); assertThat("testFindAuthorized 2",found,notNullValue()); assertTrue("testFindAuthorized 3",found.length == 0); found = Collection.findAuthorized(context, com, Constants.ADD); assertThat("testFindAuthorized 3",found,notNullValue()); assertTrue("testFindAuthorized 4",found.length == 0); found = Collection.findAuthorized(context, null, Constants.ADD); assertThat("testFindAuthorized 5",found,notNullValue()); assertTrue("testFindAuthorized 6",found.length == 0); found = Collection.findAuthorized(context, com, Constants.READ); assertThat("testFindAuthorized 7",found,notNullValue()); assertTrue("testFindAuthorized 8",found.length == 0); found = Collection.findAuthorized(context, null, Constants.READ); assertThat("testFindAuthorized 9",found,notNullValue()); assertTrue("testFindAuthorized 10",found.length >= 1); }