@Test
public void testInheritCollectionDefaultPolicies() throws AuthorizeException, SQLException
{

    //TODO: we would need a method to get policies from collection, probably better!
    List<ResourcePolicy> defaultCollectionPolicies = authorizeService.getPoliciesActionFilter(context, collection,
            Constants.DEFAULT_BITSTREAM_READ);
    Iterator<ResourcePolicy> it = defaultCollectionPolicies.iterator();
    bundleService.inheritCollectionDefaultPolicies(context, b, collection);
    while (it.hasNext())
    {
        ResourcePolicy rp = (ResourcePolicy) it.next();
        rp.setAction(Constants.READ);
    }
    List<ResourcePolicy> bspolicies = bundleService.getBundlePolicies(context, b);
    assertTrue("testInheritCollectionDefaultPolicies 0", defaultCollectionPolicies.size() == bspolicies.size());
    boolean equals = false;
    for(int i=0; i < defaultCollectionPolicies.size(); i++)
    {
        ResourcePolicy collectionPolicy = defaultCollectionPolicies.get(i);
        ResourcePolicy bundlePolicy = bspolicies.get(i);
        if(collectionPolicy.getAction() == bundlePolicy.getAction() && collectionPolicy.getGroup().equals(bundlePolicy.getGroup()))
        {
            equals = true;
        }
    }
    assertTrue("testInheritCollectionDefaultPolicies 1", equals);
    bspolicies = bundleService.getBitstreamPolicies(context, b);
    boolean exists = true;
    for(int i=0; bspolicies.size() > 0 && i < defaultCollectionPolicies.size(); i++)
    {
        ResourcePolicy collectionPolicy = defaultCollectionPolicies.get(i);
        ResourcePolicy bitstreamPolicy = bspolicies.get(i);
        if(collectionPolicy.getAction() == bitstreamPolicy.getAction() && collectionPolicy.getGroup().equals(bitstreamPolicy.getGroup()))
        {
            exists = true;
        }
    }
    assertTrue("testInheritCollectionDefaultPolicies 2", exists);
}