@Test
public void testUpdateDemand() {

  conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false");
  resourceManager = new MockRM(conf);
  resourceManager.start();
  scheduler = (FairScheduler) resourceManager.getResourceScheduler();
  scheduler.allocConf = mock(AllocationConfiguration.class);
  String queueName = "root.queue1";
  when(scheduler.allocConf.getMaxResources(queueName)).thenReturn(maxResource);
  when(scheduler.allocConf.getMinResources(queueName)).thenReturn(Resources.none());
  FSLeafQueue schedulable = new FSLeafQueue(queueName, scheduler, null);
  FSAppAttempt app = mock(FSAppAttempt.class);
  Mockito.when(app.getDemand()).thenReturn(maxResource);
  schedulable.addAppSchedulable(app);
  schedulable.addAppSchedulable(app);
  schedulable.updateDemand();
  assertTrue("Demand is greater than max allowed ",
      Resources.equals(schedulable.getDemand(), maxResource));
}