@Test
  public void testEmptyDistribution() {
    Map<ServerName, List<RegionInfo>> serverToRegions = new HashMap<>();

    BalancerClusterState clusterState = createMockBalancerClusterState(serverToRegions);
    DummyBalancerClusterState state = new DummyBalancerClusterState(clusterState);

    StoreFileTableSkewCostFunction costFunction =
      new StoreFileTableSkewCostFunction(new Configuration());
    costFunction.prepare(state);
    double cost = costFunction.cost();

    // Expect zero cost when there is no load.
    assertEquals("Empty distribution should yield zero cost", 0.0, cost, 1e-6);
  }
Tests that an empty cluster (no servers/regions) is handled gracefully.
hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java