@Test
  public void testCacheExpiry() throws IOException, MetaException, LoginException, InterruptedException {
    HiveClientCache cache = new HiveClientCache(1);
    HiveClientCache.ICacheableMetaStoreClient client = (HiveClientCache.ICacheableMetaStoreClient) cache.get(hiveConf);
    assertNotNull(client);

    Thread.sleep(2500);
    HiveClientCache.ICacheableMetaStoreClient client2 = (HiveClientCache.ICacheableMetaStoreClient) cache.get(hiveConf);
    client.close();
    assertTrue(client.isClosed()); // close() after *expiry time* and *a cache access* should  have tore down the client

    assertNotNull(client2);
    assertNotSame(client, client2);
  }
Check that a new client is returned for the same configuration after the expiry time.
Also verify that the expiry time configuration is honoured
hcatalog/core/src/test/java/org/apache/hive/hcatalog/common/TestHiveClientCache.java