public void testSkipCacheDataBlocksInteral(int heavyEvictionCountLimit) throws Exception {
    long maxSize = 100000000;
    int numBlocks = 100000;
    final long blockSize = calculateBlockSizeDefault(maxSize, numBlocks);
    assertTrue("calculateBlockSize appears broken.", blockSize * numBlocks <= maxSize);

    final LruAdaptiveBlockCache cache = new LruAdaptiveBlockCache(maxSize, blockSize, true,
      (int) Math.ceil(1.2 * maxSize / blockSize), LruAdaptiveBlockCache.DEFAULT_LOAD_FACTOR,
      LruAdaptiveBlockCache.DEFAULT_CONCURRENCY_LEVEL, 0.5f, // min
      0.99f, // acceptable
      0.33f, // single
      0.33f, // multi
      0.34f, // memory
      1.2f, // limit
      false, maxSize, heavyEvictionCountLimit, 200, 0.01f);

    EvictionThread evictionThread = cache.getEvictionThread();
    assertNotNull(evictionThread);
    Waiter.waitFor(CONF, 10000, 10, () -> evictionThread.isEnteringRun());

    final String hfileName = "hfile";
    for (int blockIndex = 0; blockIndex <= numBlocks * 3000; ++blockIndex) {
      CachedItem block = new CachedItem(hfileName, (int) blockSize, blockIndex);
      cache.cacheBlock(block.cacheKey, block, false);
      if (cache.getCacheDataBlockPercent() < 70) {
        // enough for test
        break;
      }
    }

    evictionThread.evict();
    Thread.sleep(100);

    if (heavyEvictionCountLimit == 0) {
      // Check if all offset (last two digits) of cached blocks less than the percent.
      // It means some of blocks haven't put into BlockCache
      assertTrue(cache.getCacheDataBlockPercent() < 90);
      for (BlockCacheKey key : cache.getMapForTests().keySet()) {
        assertTrue(!(key.getOffset() % 100 > 90));
      }
    } else {
      // Check that auto-scaling is not working (all blocks in BlockCache)
      assertTrue(cache.getCacheDataBlockPercent() == 100);
      int counter = 0;
      for (BlockCacheKey key : cache.getMapForTests().keySet()) {
        if (key.getOffset() % 100 > 90) {
          counter++;
        }
      }
      assertTrue(counter > 1000);
    }
    evictionThread.shutdown();
  }
Size of the cache block holding this item. Used for verification.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruAdaptiveBlockCache.java