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