@Test
public void testComputeAvailableContainers() throws Exception {

  Resource clusterAvailableResources = Resource.newInstance(81920, 40);
  Resource nonZeroResource = Resource.newInstance(1024, 2);
  int expectedNumberOfContainersForMemory = 80;
  int expectedNumberOfContainersForCPU = 20;
  verifyDifferentResourceTypes(clusterAvailableResources, nonZeroResource,
      expectedNumberOfContainersForMemory,
      expectedNumberOfContainersForCPU);
  Resource zeroMemoryResource = Resource.newInstance(0,
      nonZeroResource.getVirtualCores());
  verifyDifferentResourceTypes(clusterAvailableResources, zeroMemoryResource,
      Integer.MAX_VALUE,
      expectedNumberOfContainersForCPU);
  Resource zeroCpuResource = Resource.newInstance(
      nonZeroResource.getMemorySize(), 0);
  verifyDifferentResourceTypes(clusterAvailableResources, zeroCpuResource,
      expectedNumberOfContainersForMemory,
      expectedNumberOfContainersForMemory);
}