### Question:
WorkspaceItem implements InProgressSubmission { public static WorkspaceItem[] findByCollection(Context context, Collection c) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem WHERE " + "workspaceitem.collection_id= ? ", c.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); } WorkspaceItem(Context context, TableRow row); static WorkspaceItem find(Context context, int id); static WorkspaceItem create(Context c, Collection coll,
            boolean template); static WorkspaceItem[] findByEPerson(Context context, EPerson ep); static WorkspaceItem[] findByCollection(Context context, Collection c); static WorkspaceItem findByItem(Context context, Item i); static WorkspaceItem[] findAll(Context context); int getID(); int getStageReached(); void setStageReached(int v); int getPageReached(); void setPageReached(int v); void update(); boolean equals(Object o); int hashCode(); void deleteAll(); void deleteWrapper(); Item getItem(); Collection getCollection(); EPerson getSubmitter(); boolean hasMultipleFiles(); void setMultipleFiles(boolean b); boolean hasMultipleTitles(); void setMultipleTitles(boolean b); boolean isPublishedBefore(); void setPublishedBefore(boolean b);  }### Answer:
@Test public void testFindByCollection() throws Exception { Collection c = wi.getCollection(); WorkspaceItem[] found = WorkspaceItem.findByCollection(context, c); assertThat("testFindByCollection 0",found,notNullValue()); assertTrue("testFindByCollection 1",found.length >= 1); assertThat("testFindByCollection 2",found[0].getID(), equalTo(wi.getID())); assertThat("testFindByCollection 3",found[0], equalTo(wi)); assertThat("testFindByCollection 4",found[0].getCollection(),equalTo(wi.getCollection())); }