### Question:
Bundle extends DSpaceObject { public void replaceAllBitstreamPolicies(List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException { if (bitstreams != null && bitstreams.size() > 0) { for (Bitstream bs : bitstreams) { AuthorizeManager.removeAllPolicies(ourContext, bs); AuthorizeManager.addPolicies(ourContext, newpolicies, bs); } } AuthorizeManager.removeAllPolicies(ourContext, this); AuthorizeManager.addPolicies(ourContext, newpolicies, this); } 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 testReplaceAllBitstreamPolicies() throws SQLException, AuthorizeException { List<ResourcePolicy> newpolicies = new ArrayList<ResourcePolicy>(); newpolicies.add(ResourcePolicy.create(context)); newpolicies.add(ResourcePolicy.create(context)); newpolicies.add(ResourcePolicy.create(context)); b.replaceAllBitstreamPolicies(newpolicies); List<ResourcePolicy> bspolicies = b.getBundlePolicies(); assertTrue("testReplaceAllBitstreamPolicies 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("testReplaceAllBitstreamPolicies 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("testReplaceAllBitstreamPolicies 2", exists); }