@Test
public void testIfNoSubclustersWithWeightOne() {

  setPolicy(new LoadBasedRouterPolicy());
  setPolicyInfo(new WeightedPolicyInfo());
  Map<SubClusterIdInfo, Float> routerWeights = new HashMap<>();
  Map<SubClusterIdInfo, Float> amrmWeights = new HashMap<>();
  // update subcluster with weight 0
  SubClusterIdInfo sc = new SubClusterIdInfo(String.format("sc%02d", 0));
  SubClusterInfo federationSubClusterInfo = SubClusterInfo.newInstance(
      sc.toId(), null, null, null, null, -1, SubClusterState.SC_RUNNING, -1,
      generateClusterMetricsInfo(0));
  getActiveSubclusters().clear();
  getActiveSubclusters().put(sc.toId(), federationSubClusterInfo);
  routerWeights.put(sc, 0.0f);
  amrmWeights.put(sc, 0.0f);
  getPolicyInfo().setRouterPolicyWeights(routerWeights);
  getPolicyInfo().setAMRMPolicyWeights(amrmWeights);
  try {
    FederationPoliciesTestUtil.initializePolicyContext(getPolicy(),
        getPolicyInfo(), getActiveSubclusters());
    ((FederationRouterPolicy) getPolicy())
        .getHomeSubcluster(getApplicationSubmissionContext(), null);
    fail();
  } catch (YarnException ex) {
    Assert.assertTrue(
        ex.getMessage().contains("Zero Active Subcluster with weight 1"));
  }
}