@Test
public void testFindAllByMediaPackage() throws Exception {

  // Store an asset
  StoragePath path1 = new StoragePath(ORG, MP_ID, new VersionImpl(1L), ASSET1_ID);
  database.storeMapping(path1, "archive_path/" + ASSET1_ID, AWS_VERSION_1);
  // Store another asset
  StoragePath path2 = new StoragePath(ORG, MP_ID, new VersionImpl(1L), ASSET2_ID);
  database.storeMapping(path2, "archive_path/" + ASSET2_ID, AWS_VERSION_2);
  // Another version of the asset 1 (same checksum)
  StoragePath path = new StoragePath(ORG, MP_ID, new VersionImpl(2L), ASSET1_ID);
  database.storeMapping(path, "archive_path/" + ASSET1_ID, AWS_VERSION_1);
  // One more version
  path = new StoragePath(ORG, MP_ID, new VersionImpl(3L), ASSET1_ID);
  database.storeMapping(path, "archive_path/" + ASSET1_ID, AWS_VERSION_1);
  // Delete version 1
  database.deleteMapping(path1);
  database.deleteMapping(path2);
  // Search by media package
  List<AwsAssetMapping> mappings = database.findAllByMediaPackage(MP_ID);
  // Deleted assets should also be returned
  Assert.assertEquals(4, mappings.size());
}