private void checkRegionLocationIsCached(final TableName tableName, final Connection conn)
    throws InterruptedException, IOException {
    for (int count = 0; count < 50; count++) {
      int number = ((AsyncConnectionImpl) conn.toAsyncConnection()).getLocator()
        .getNumberOfCachedRegionLocations(tableName);
      assertNotEquals("Expected non-zero number of cached region locations", 0, number);
      Thread.sleep(100);
    }
  }
Method to check whether the cached region location is non-empty for the given table. It repeats
the same check several times as clearing of cache by some async operations may not reflect
immediately.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRegionLocationCaching.java