ObjectApi srcApi = api.objectApiInRegionForContainer(regionId, sourceContainer);
ObjectApi destApi = api.objectApiInRegionForContainer(regionId, destinationContainer);
// Create source object
assertNotNull(srcApi.replace(sourceObjectName, data, ImmutableMap.<String, String> of()));
SwiftObject sourceObject = srcApi.get(sourceObjectName, GetOptions.NONE);
checkObject(sourceObject);
// Create the destination object
assertNotNull(destApi.replace(destinationObject, data, ImmutableMap.<String, String> of()));
SwiftObject object = destApi.get(destinationObject, GetOptions.NONE);
checkObject(object);
// check the copy operation
assertTrue(destApi.copy(destinationObject, sourceContainer, sourceObjectName));
assertNotNull(destApi.head(destinationObject));
// now get a real SwiftObject
SwiftObject destSwiftObject = destApi.get(destinationObject, GetOptions.NONE);
assertEquals(Strings2.toString(destSwiftObject.getPayload()), stringPayload);
// test exception thrown on bad source name
try {
destApi.copy(destinationObject, badSource, sourceObjectName);
fail("Expected CopyObjectException");