@Test
public void testAppPercentagesOnswitch() throws Exception {

  FifoScheduler scheduler = mock(FifoScheduler.class);
  when(scheduler.getClusterResource()).thenReturn(Resource.newInstance(0, 0));
  when(scheduler.getResourceCalculator())
      .thenReturn(new DefaultResourceCalculator());
  ApplicationAttemptId appAttId = createAppAttemptId(0, 0);
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getEpoch()).thenReturn(3L);
  when(rmContext.getScheduler()).thenReturn(scheduler);
  when(rmContext.getYarnConfiguration()).thenReturn(conf);
  final String user = "user1";
  Queue queue = createQueue("test", null);
  SchedulerApplicationAttempt app = new SchedulerApplicationAttempt(appAttId,
      user, queue, queue.getAbstractUsersManager(), rmContext);
  // Resource request
  Resource requestedResource = Resource.newInstance(1536, 2);
  app.attemptResourceUsage.incUsed(requestedResource);
  assertEquals(0.0f, app.getResourceUsageReport().getQueueUsagePercentage(),
      0.0f);
  assertEquals(0.0f, app.getResourceUsageReport().getClusterUsagePercentage(),
      0.0f);
}