collection.removeResource(newResource);
}
public void testRemove() throws Exception {
Collection collection = client.getCollection(TEST_COLLECTION_PATH);
if (collection == null) {
throw new Exception("getCollection(" + TEST_COLLECTION_PATH + ") returned null");
}
/*
* Create a binary resource, save it in the 'current' collection,
* then remove it and verify that it was indeed removed.
*/
Resource newResource = collection.createResource(null, "BinaryResource");
newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
collection.storeResource(newResource);
String id = newResource.getId();
Resource foundResource = collection.getResource(id);
assertNotNull("It should be in there", foundResource);
collection.removeResource(foundResource);
foundResource = collection.getResource(id);
assertNull("It should not be in there anymore", foundResource);
}