@Test
  public void testDeleteAfterPartialCompaction() throws Exception {
    BlobStorageException ex = mockStorageException(BlobErrorCode.BLOB_NOT_FOUND);
    when(mockBlockBlobAsyncClient.getPropertiesWithResponse(any())).thenReturn(Mono.error(ex));
    // Rig Cosmos to return us a deleted blob on read request
    long deletionTime = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10);
    CloudBlobMetadata deletedMetadata = new CloudBlobMetadata().setId(blobId.getID()).setDeletionTime(deletionTime);
    CosmosItemResponse mockResponse = mock(CosmosItemResponse.class);
    when(mockResponse.getItem()).thenReturn(deletedMetadata);
    when(mockCosmosAsyncContainer.readItem(anyString(), any(), any())).thenReturn(Mono.just(mockResponse));
    // Now delete the puppy, Cosmos record should get purged.
    try {
      assertFalse("Expected update to recover and return false",
          azureDest.deleteBlob(blobId, deletionTime, (short) 0, dummyCloudUpdateValidator));
    } catch (CloudStorageException cex) {
      assertTrue(cex.getCause() instanceof BlobStorageException);
      assertEquals(((BlobStorageException) cex.getCause()).getErrorCode(), BlobErrorCode.BLOB_NOT_FOUND);
    }
    assertEquals("Expected recovery", 1, azureMetrics.blobUpdateRecoverCount.getCount());
    verify(mockCosmosAsyncContainer).deleteItem(anyString(), (PartitionKey) any());
  }
Test delete when record is in Cosmos but not ABS.
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/AzureCloudDestinationTest.java