@Test
  public void testCacheCost() {
    conf.set(HConstants.BUCKET_CACHE_PERSISTENT_PATH_KEY, "/tmp/prefetch.persistence");
    CacheAwareLoadBalancer.CacheAwareCostFunction costFunction =
      new CacheAwareLoadBalancer.CacheAwareCostFunction(conf);

    for (int test = 0; test < clusterRegionCacheRatioMocks.length; test++) {
      int[][] clusterRegionLocations = clusterRegionCacheRatioMocks[test];
      MockClusterForCacheCost cluster = new MockClusterForCacheCost(clusterRegionLocations);
      costFunction.prepare(cluster);
      double cost = costFunction.cost();
      assertEquals(expectedCacheCost[test], cost, 0.01);
    }
  }
Data set to testCacheCost: [test][0][0] = mapping of server to number of regions it hosts
[test][region + 1][0] = server that region is hosted on [test][region + 1][server + 1] = size
of region cached on server
hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestCacheAwareLoadBalancerCostFunctions.java