### Question:
Bundle extends DSpaceObject { public void inheritCollectionDefaultPolicies(Collection c) throws java.sql.SQLException, AuthorizeException { List<ResourcePolicy> policies = AuthorizeManager.getPoliciesActionFilter(ourContext, c, Constants.DEFAULT_BITSTREAM_READ); Iterator<ResourcePolicy> i = policies.iterator(); if (!i.hasNext()) { throw new java.sql.SQLException("Collection " + c.getID() + " has no default bitstream READ policies"); } while (i.hasNext()) { ResourcePolicy rp = (ResourcePolicy) i.next(); rp.setAction(Constants.READ); } replaceAllBitstreamPolicies(policies); } Bundle(Context context, TableRow row); static Bundle find(Context context, int id); int getID(); String getName(); void setName(String name); int getPrimaryBitstreamID(); void setPrimaryBitstreamID(int bitstreamID); void unsetPrimaryBitstreamID(); String getHandle(); Bitstream getBitstreamByName(String name); Bitstream[] getBitstreams(); Item[] getItems(); Bitstream createBitstream(InputStream is); Bitstream registerBitstream(int assetstore, String bitstreamPath); void addBitstream(Bitstream b); void setOrder(int bitstreamIds[]); void removeBitstream(Bitstream b); void update(); int getType(); void inheritCollectionDefaultPolicies(Collection c); void replaceAllBitstreamPolicies(List<ResourcePolicy> newpolicies); List<ResourcePolicy> getBundlePolicies(); List<ResourcePolicy> getBitstreamPolicies(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject();  }### Answer:
@Test public void testInheritCollectionDefaultPolicies() throws AuthorizeException, SQLException { Collection c = Collection.create(context); List<ResourcePolicy> newpolicies = AuthorizeManager.getPoliciesActionFilter(context, c, Constants.DEFAULT_BITSTREAM_READ); Iterator<ResourcePolicy> it = newpolicies.iterator(); while (it.hasNext()) { ResourcePolicy rp = (ResourcePolicy) it.next(); rp.setAction(Constants.READ); } b.inheritCollectionDefaultPolicies(c); List<ResourcePolicy> bspolicies = b.getBundlePolicies(); assertTrue("testInheritCollectionDefaultPolicies 0", newpolicies.size() == bspolicies.size()); boolean equals = true; for(int i=0; i < newpolicies.size() && equals; i++) { if(!newpolicies.contains(bspolicies.get(i))) { equals = false; } } assertTrue("testInheritCollectionDefaultPolicies 1", equals); bspolicies = b.getBitstreamPolicies(); boolean exists = true; for(int i=0; bspolicies.size() > 0 && i < newpolicies.size() && exists; i++) { if(!bspolicies.contains(newpolicies.get(i))) { exists = false; } } assertTrue("testInheritCollectionDefaultPolicies 2", exists); }