@Test
  public void testUpdateCosmosException() {
    mockBlobExistence(true);
    Duration mockDuration = mock(Duration.class);
    when(mockDuration.toMillis()).thenReturn(Long.valueOf(10));
    CosmosException cosmosException = mock(CosmosException.class);
    when(cosmosException.getStatusCode()).thenReturn(500);
    when(cosmosException.getRetryAfterDuration()).thenReturn(mockDuration);
    when(mockCosmosAsyncContainer.readItem(anyString(), any(), any())).thenReturn(Mono.error(cosmosException));
    expectCloudStorageException(() -> azureDest.deleteBlob(blobId, deletionTime, (short) 0, dummyCloudUpdateValidator),
        CosmosException.class);
    expectCloudStorageException(() -> azureDest.updateBlobExpiration(blobId, expirationTime, dummyCloudUpdateValidator),
        CosmosException.class);
    expectCloudStorageException(() -> azureDest.undeleteBlob(blobId, (short) 0, dummyCloudUpdateValidator),
        CosmosException.class);
    verifyUpdateErrorMetrics(3, true);
  }
Test update methods when Cosmos throws other exception.
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/AzureCloudDestinationTest.java