@Test
  public void testCheckpoints() throws Exception {
    when(mockBlockBlobAsyncClient.uploadWithResponse(any(), anyLong(), any(), any(), any(), any(), any())).thenReturn(
        Mono.just(mock(Response.class)));
    // Existing checkpoint
    Map<String, Long> realCheckpoints = new HashMap<>();
    long now = System.currentTimeMillis();
    realCheckpoints.put(CloudBlobMetadata.FIELD_DELETION_TIME, now - TimeUnit.DAYS.toMillis(1));
    realCheckpoints.put(CloudBlobMetadata.FIELD_EXPIRATION_TIME, now - TimeUnit.DAYS.toMillis(2));
    mockCheckpointDownload(true, objectMapper.writeValueAsString(realCheckpoints));
    Map<String, Long> checkpoints = azureStorageCompactor.getCompactionProgress(partitionPath);
    assertEquals("Expected checkpoint to match", realCheckpoints, checkpoints);
    // Successful update
    assertTrue("Expected update to return true",
        azureStorageCompactor.updateCompactionProgress(partitionPath, CloudBlobMetadata.FIELD_EXPIRATION_TIME, now));
    // Update skipped due to earlier time
    assertFalse("Expected update to return false",
        azureStorageCompactor.updateCompactionProgress(partitionPath, CloudBlobMetadata.FIELD_EXPIRATION_TIME,
            now - TimeUnit.DAYS.toMillis(3)));

    // No checkpoint
    mockCheckpointDownload(false, null);
    checkpoints = azureStorageCompactor.getCompactionProgress(partitionPath);
    assertEquals("Expected empty checkpoint", AzureStorageCompactor.emptyCheckpoints, checkpoints);
  }
Test compaction progress methods, normal cases
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/AzureStorageCompactorTest.java