UUID transferId = UUID.randomUUID();
BlobTransferTarget transferTarget = mock(BlobTransferTarget.class);
TransportService transportService = mock(TransportService.class);
DiscoveryNode discoveryNode = mock(DiscoveryNode.class);
PutHeadChunkRunnable runnable = new PutHeadChunkRunnable(
file, 5, transportService, transferTarget, discoveryNode, transferId
);
@SuppressWarnings("unchecked")
TransportFuture<TransportResponse.Empty> result = mock(TransportFuture.class);
when(transportService.submitRequest(
eq(discoveryNode),
eq(BlobHeadRequestHandler.Actions.PUT_BLOB_HEAD_CHUNK),
any(TransportRequest.class),
any(TransportRequestOptions.class),
eq(EmptyTransportResponseHandler.INSTANCE_SAME)
)).thenReturn(result);
runnable.run();
}