private void testRetrievalUtils(Path testDir, String ioEngineName)
    throws IOException, InterruptedException {
    final String persistencePath =
      testDir + "/bucket.persistence" + EnvironmentEdgeManager.currentTime();
    BucketCache bucketCache = null;
    try {
      bucketCache = new BucketCache(ioEngineName, capacitySize, constructedBlockSize,
        constructedBlockSizes, writeThreads, writerQLen, persistencePath);
      assertTrue(bucketCache.waitForCacheInitialization(10000));
      long usedSize = bucketCache.getAllocator().getUsedSize();
      assertEquals(0, usedSize);
      HFileBlockPair[] blocks = CacheTestUtils.generateHFileBlocks(constructedBlockSize, 1);
      for (HFileBlockPair block : blocks) {
        bucketCache.cacheBlock(block.getBlockName(), block.getBlock());
      }
      for (HFileBlockPair block : blocks) {
        cacheAndWaitUntilFlushedToBucket(bucketCache, block.getBlockName(), block.getBlock(),
          false);
      }
      usedSize = bucketCache.getAllocator().getUsedSize();
      assertNotEquals(0, usedSize);
      bucketCache.shutdown();
      assertTrue(new File(persistencePath).exists());
      bucketCache = new BucketCache(ioEngineName, capacitySize, constructedBlockSize,
        constructedBlockSizes, writeThreads, writerQLen, persistencePath);
      assertTrue(bucketCache.waitForCacheInitialization(10000));

      assertEquals(usedSize, bucketCache.getAllocator().getUsedSize());
    } finally {
      if (bucketCache != null) {
        bucketCache.shutdown();
      }
    }
    assertTrue(new File(persistencePath).exists());
  }
<pre>
The asserts here before HBASE-21957 are:
assertEquals(1L, cache.getBlockCount());
assertTrue(cache.getCurrentSize() > 0L);
assertTrue("We should have a block!", cache.iterator().hasNext());

The asserts here after HBASE-21957 are:
assertEquals(0, cache.getBlockCount());
assertEquals(cache.getCurrentSize(), 0L);

I think the asserts before HBASE-21957 is more reasonable,because
{@link BucketCache#evictBlock} should only evict the {@link BucketEntry}
it had seen, and newly added Block after the {@link BucketEntry}
it had seen should not be evicted.
</pre>
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java