@Test
public void testAbsoluteMaxAvailCapacityNoUse() throws Exception {

  
  ResourceCalculator resourceCalculator = new DefaultResourceCalculator();
  Resource clusterResource = Resources.createResource(100 * 16 * GB, 100 * 32);
  
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();
  
  CapacitySchedulerContext csContext = mock(CapacitySchedulerContext.class);
  when(csContext.getConf()).thenReturn(conf);
  when(csContext.getConfiguration()).thenReturn(csConf);
  when(csContext.getClusterResource()).thenReturn(clusterResource);
  when(csContext.getResourceCalculator()).thenReturn(resourceCalculator);
  when(csContext.getMinimumResourceCapability()).
      thenReturn(Resources.createResource(GB, 1));
  when(csContext.getMaximumResourceCapability()).
      thenReturn(Resources.createResource(16*GB, 32));
  RMContext rmContext = TestUtils.getMockRMContext();
  when(csContext.getRMContext()).thenReturn(rmContext);
  
  final String L1Q1 = "L1Q1";
  csConf.setQueues(CapacitySchedulerConfiguration.ROOT, new String[] {L1Q1});
  
  final String L1Q1P = CapacitySchedulerConfiguration.ROOT + "." + L1Q1;
  csConf.setCapacity(L1Q1P, 90);
  csConf.setMaximumCapacity(L1Q1P, 90);
  
  ParentQueue root = new ParentQueue(csContext, 
      CapacitySchedulerConfiguration.ROOT, null, null);
  LeafQueue l1q1 = new LeafQueue(csContext, L1Q1, root, null);
  
  LOG.info("t1 root " + CSQueueUtils.getAbsoluteMaxAvailCapacity(
    resourceCalculator, clusterResource, root));
  
  LOG.info("t1 l1q1 " + CSQueueUtils.getAbsoluteMaxAvailCapacity(
    resourceCalculator, clusterResource, l1q1));
  
  assertEquals(1.0f, CSQueueUtils.getAbsoluteMaxAvailCapacity(
    resourceCalculator, clusterResource, root), 0.000001f);
  
  assertEquals(0.9f, CSQueueUtils.getAbsoluteMaxAvailCapacity(
    resourceCalculator, clusterResource, l1q1), 0.000001f);
  
}