@Test
public void testIdealAllocationForLabels() {

  int[][] qData = new int[][] {
  // / A B
      { 80, 40, 40 }, // abs
      { 80, 80, 80 }, // maxcap
      { 80, 80, 0 }, // used
      { 70, 20, 50 }, // pending
      { 0, 0, 0 }, // reserved
      { 5, 4, 1 }, // apps
      { -1, 1, 1 }, // req granularity
      { 2, 0, 0 }, // subqueues
  };
  setAMContainer = true;
  setLabeledContainer = true;
  Map<NodeId, Set<String>> labels = new HashMap<NodeId, Set<String>>();
  NodeId node = NodeId.newInstance("node1", 0);
  Set<String> labelSet = new HashSet<String>();
  labelSet.add("x");
  labels.put(node, labelSet);
  when(lm.getNodeLabels()).thenReturn(labels);
  ProportionalCapacityPreemptionPolicy policy = buildPolicy(qData);
  // Subtracting Label X resources from cluster resources
  when(lm.getResourceByLabel(anyString(), any(Resource.class))).thenReturn(
      Resources.clone(Resource.newInstance(80, 0)));
  clusterResources.setMemory(100);
  policy.editSchedule();
  // By skipping AM Container and Labeled container, all other 18 containers
  // of appD will be
  // preempted
  verify(mDisp, times(19)).handle(argThat(new IsPreemptionRequestFor(appD)));
  // By skipping AM Container and Labeled container, all other 18 containers
  // of appC will be
  // preempted
  verify(mDisp, times(19)).handle(argThat(new IsPreemptionRequestFor(appC)));
  // rest 4 containers from appB will be preempted
  verify(mDisp, times(2)).handle(argThat(new IsPreemptionRequestFor(appB)));
  setAMContainer = false;
  setLabeledContainer = false;
}