use of com.google.cloud.storage.Storage.BlobSourceOption in project google-cloud-java by GoogleCloudPlatform.
the class StorageBatchTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() {
EasyMock.reset(batchMock);
Capture<RpcBatch.Callback<Void>> callback = Capture.newInstance();
Capture<Map<StorageRpc.Option, Object>> capturedOptions = Capture.newInstance();
batchMock.addDelete(EasyMock.eq(BLOB_INFO.toPb()), EasyMock.capture(callback), EasyMock.capture(capturedOptions));
EasyMock.replay(batchMock);
StorageBatchResult<Boolean> batchResult = storageBatch.delete(BLOB_ID, BLOB_SOURCE_OPTIONS);
assertNotNull(callback.getValue());
assertEquals(2, capturedOptions.getValue().size());
for (BlobSourceOption option : BLOB_SOURCE_OPTIONS) {
assertEquals(option.getValue(), capturedOptions.getValue().get(option.getRpcOption()));
}
RpcBatch.Callback<Void> capturedCallback = callback.getValue();
capturedCallback.onSuccess(null);
assertTrue(batchResult.get());
}
Aggregations