@Before
  public void setup() throws Exception {
    long partition = 666;
    PartitionId partitionId = new MockPartitionId(partition, MockClusterMap.DEFAULT_PARTITION_CLASS);
    blobId = new BlobId(BLOB_ID_V6, BlobIdType.NATIVE, dataCenterId, accountId, containerId, partitionId, false,
        BlobDataType.DATACHUNK);
    CloudBlobMetadata blobMetadata =
        new CloudBlobMetadata(blobId, 0, Utils.Infinite_Time, blobSize, CloudBlobMetadata.EncryptionOrigin.NONE);

    mockServiceAsyncClient = mock(BlobServiceAsyncClient.class);
    mockBlobBatchAsyncClient = mock(BlobBatchAsyncClient.class);
    mockBlockBlobAsyncClient = AzureBlobDataAccessorTest.setupMockBlobAsyncClient(mockServiceAsyncClient);
    mockBlobExistence(false);
    when(mockBlockBlobAsyncClient.uploadWithResponse(any(), anyLong(), any(), any(), any(), any(), any())).thenReturn(
        Mono.just(mock(Response.class)));

    Response<BlobProperties> blobPropertiesResponse = mock(Response.class);
    when(blobPropertiesResponse.getValue()).thenReturn(mock(BlobProperties.class));
    when(mockBlockBlobAsyncClient.getPropertiesWithResponse(any())).thenReturn(Mono.just(blobPropertiesResponse));
    when(mockBlockBlobAsyncClient.setMetadataWithResponse(any(), any())).thenReturn(Mono.just(mock(Response.class)));

    mockCosmosAsyncClient = mock(CosmosAsyncClient.class);
    mockCosmosAsyncDatabase = mock(CosmosAsyncDatabase.class);
    mockCosmosAsyncContainer = mock(CosmosAsyncContainer.class);
    when(mockCosmosAsyncDatabase.getContainer(anyString())).thenReturn(mockCosmosAsyncContainer);
    CosmosItemResponse cosmosItemResponse = mock(CosmosItemResponse.class);
    when(cosmosItemResponse.getItem()).thenReturn(blobMetadata);
    when(mockCosmosAsyncContainer.readItem(anyString(), any(), any())).thenReturn(Mono.just(cosmosItemResponse));
    when(mockCosmosAsyncContainer.upsertItem(any(), any(), any())).thenReturn(Mono.just(cosmosItemResponse));
    when(mockCosmosAsyncContainer.replaceItem(any(), anyString(), any(), any())).thenReturn(
        Mono.just(cosmosItemResponse));
    when(mockCosmosAsyncContainer.deleteItem(anyString(), (PartitionKey) any())).thenReturn(Mono.empty());
    Duration mockDuration = mock(Duration.class);
    when(mockDuration.toMillis()).thenReturn(Long.valueOf(10));
    mockNotFoundCosmosException = mock(CosmosException.class);
    when(mockNotFoundCosmosException.getStatusCode()).thenReturn(STATUS_NOT_FOUND);
    when(mockNotFoundCosmosException.getRetryAfterDuration()).thenReturn(mockDuration);

    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_CONNECTION_STRING, storageConnection);
    configProps.setProperty(AzureCloudConfig.COSMOS_ENDPOINT, "http://ambry.beyond-the-cosmos.com:443");
    configProps.setProperty(AzureCloudConfig.COSMOS_DATABASE, "ambry");
    configProps.setProperty(AzureCloudConfig.COSMOS_COLLECTION, "metadata");
    configProps.setProperty(AzureCloudConfig.COSMOS_DELETED_CONTAINER_COLLECTION, "deletedContainer");
    configProps.setProperty(AzureCloudConfig.COSMOS_KEY, "cosmos-key");
    configProps.setProperty("clustermap.cluster.name", "main");
    configProps.setProperty("clustermap.datacenter.name", "uswest");
    configProps.setProperty("clustermap.host.name", "localhost");
    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_AUTHORITY,
        "https://login.microsoftonline.com/test-account/");
    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_CLIENTID, "client-id");
    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_SECRET, "client-secret");
    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_ENDPOINT, "https://azure_storage.blob.core.windows.net");
    configProps.setProperty(AzureCloudConfig.AZURE_STORAGE_CLIENT_CLASS,
        "com.github.ambry.cloud.azure.ConnectionStringBasedStorageClient");
    vcrMetrics = new VcrMetrics(new MetricRegistry());
    azureMetrics = new AzureMetrics(new MetricRegistry());
    clusterMap = mock(ClusterMap.class);
    azureDest = new AzureCloudDestination(mockServiceAsyncClient, mockBlobBatchAsyncClient, mockCosmosAsyncClient,
        mockCosmosAsyncDatabase, mockCosmosAsyncContainer, "ambry", "metadata", "deletedContainer", clusterName,
        azureMetrics, defaultAzureReplicationFeedType, clusterMap, false, configProps);
  }
Utility method to get blob input stream.
@param blobSize size of blob to consider.
@return the blob input stream.
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/AzureCloudDestinationTest.java