@Test (timeout = 30000)
public void testNormalizeRequestWithDominantResourceCalculator() {

  ResourceCalculator resourceCalculator = new DominantResourceCalculator();
  
  Resource minResource = Resources.createResource(1024, 1);
  Resource maxResource = Resources.createResource(10240, 10);
  Resource clusterResource = Resources.createResource(10 * 1024, 10);
  
  ResourceRequest ask = new ResourceRequestPBImpl();
  // case negative memory/vcores
  ask.setCapability(Resources.createResource(-1024, -1));
  SchedulerUtils.normalizeRequest(
      ask, resourceCalculator, clusterResource, minResource, maxResource);
  assertEquals(minResource, ask.getCapability());
  // case zero memory/vcores
  ask.setCapability(Resources.createResource(0, 0));
  SchedulerUtils.normalizeRequest(
      ask, resourceCalculator, clusterResource, minResource, maxResource);
  assertEquals(minResource, ask.getCapability());
  assertEquals(1, ask.getCapability().getVirtualCores());
  assertEquals(1024, ask.getCapability().getMemory());
  // case non-zero memory & zero cores
  ask.setCapability(Resources.createResource(1536, 0));
  SchedulerUtils.normalizeRequest(
      ask, resourceCalculator, clusterResource, minResource, maxResource);
  assertEquals(Resources.createResource(2048, 1), ask.getCapability());
  assertEquals(1, ask.getCapability().getVirtualCores());
  assertEquals(2048, ask.getCapability().getMemory());
}