AllocationBasedResourceUtilizationTracker implements
    ResourceUtilizationTracker { public boolean hasEnoughCpu(float currentAllocation, long totalCores, int coresRequested) { return Math.round(currentAllocation * totalCores) + coresRequested <= totalCores; } AllocationBasedResourceUtilizationTracker(ContainerScheduler scheduler); @Override ResourceUtilization getCurrentUtilization(); @Override void addContainerResources(Container container); @Override void subtractContainerResource(Container container); @Override boolean hasResourcesAvailable(Container container); boolean hasEnoughCpu(float currentAllocation, long totalCores,
      int coresRequested); ContainersMonitor getContainersMonitor();  }
@Test public void testHasEnoughCpu() { AllocationBasedResourceUtilizationTracker tracker = new AllocationBasedResourceUtilizationTracker(mockContainerScheduler); float currentAllocation = 0.8888891f; long totalCores = 9; int alreadyUsedCores = 8; Assert.assertTrue(tracker.hasEnoughCpu(currentAllocation, totalCores, (int) totalCores - alreadyUsedCores)); Assert.assertFalse(tracker.hasEnoughCpu(currentAllocation, totalCores, (int) totalCores - alreadyUsedCores + 1)); }