@Test
public void testEviction() throws IOException {

  Configuration conf = new Configuration();
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "hdfs://localhost");
  // Only one entry will be in the cache
  final int MAX_CACHE_SIZE = 2;
  DFSClientCache cache = new DFSClientCache(conf, MAX_CACHE_SIZE);
  DFSClient c1 = cache.getDfsClient("test1");
  assertTrue(cache.getDfsClient("test1").toString().contains("ugi=test1"));
  assertEquals(c1, cache.getDfsClient("test1"));
  assertFalse(isDfsClientClose(c1));
  cache.getDfsClient("test2");
  assertTrue(isDfsClientClose(c1));
  assertEquals(MAX_CACHE_SIZE - 1, cache.clientCache.size());
}