@Test
  public void testAddToCacheReverse() throws IOException, InterruptedException {
    setupConnection(1);
    TableName tableName = TableName.valueOf("testAddToCache");
    byte[] family = Bytes.toBytes("CF");
    TableDescriptor td = TableDescriptorBuilder.newBuilder(tableName)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).build();
    int maxSplits = 10;
    List<byte[]> splits =
      IntStream.range(1, maxSplits).mapToObj(Bytes::toBytes).collect(Collectors.toList());

    TEST_UTIL.getAdmin().createTable(td, splits.toArray(new byte[0][]));
    TEST_UTIL.waitTableAvailable(tableName);
    TEST_UTIL.waitUntilNoRegionsInTransition();

    assertEquals(splits.size() + 1, TEST_UTIL.getAdmin().getRegions(tableName).size());

    RegionLocator locatorForTable = conn.getRegionLocator(tableName);
    for (int i = maxSplits; i >= 0; i--) {
      locatorForTable.getRegionLocation(Bytes.toBytes(i));
    }

    for (int i = 0; i < maxSplits; i++) {
      assertNotNull(locator.getRegionLocationInCache(tableName, Bytes.toBytes(i)));
    }
  }
Test that our cleanOverlappingRegions doesn't incorrectly remove regions from cache. Originally
encountered when using floorEntry rather than lowerEntry.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java