@Test
  public void testNotifyFileCachingCompletedSuccess() throws Exception {
    BucketCache bucketCache = null;
    try {
      Path filePath =
        new Path(HBASE_TESTING_UTILITY.getDataTestDir(), "testNotifyFileCachingCompletedSuccess");
      bucketCache = testNotifyFileCachingCompletedForTenBlocks(filePath, 10, false);
      if (bucketCache.getStats().getFailedInserts() > 0) {
        LOG.info("There were {} fail inserts, "
          + "will assert if total blocks in backingMap equals (10 - failInserts) "
          + "and file isn't listed as fully cached.", bucketCache.getStats().getFailedInserts());
        assertEquals(10 - bucketCache.getStats().getFailedInserts(), bucketCache.backingMap.size());
        assertFalse(bucketCache.fullyCachedFiles.containsKey(filePath.getName()));
      } else {
        assertTrue(bucketCache.fullyCachedFiles.containsKey(filePath.getName()));
      }
    } finally {
      if (bucketCache != null) {
        bucketCache.shutdown();
      }
      HBASE_TESTING_UTILITY.cleanupTestDir();
    }
  }
This test is for HBASE-26295, {@link BucketEntry} which is restored from a persistence file
could not be freed even if corresponding {@link HFileBlock} is evicted from
{@link BucketCache}.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java