@Test
public void testFitsInDiagnosticsCollector() {

  if (resourceCalculator instanceof DefaultResourceCalculator) {
    // required-resource = (0, 0)
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(1, 1)));
    // required-resource = (0, 1)
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(1, 1)));
    // required-resource = (1, 0)
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(1, 1)));
    // required-resource = (1, 1)
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(1, 1)));
  } else if (resourceCalculator instanceof DominantResourceCalculator) {
    // required-resource = (0, 0)
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 0),
            newResource(1, 1)));
    // required-resource = (0, 1)
    assertEquals(ImmutableSet.of(ResourceInformation.VCORES_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(ResourceInformation.VCORES_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(0, 1),
            newResource(1, 1)));
    // required-resource = (1, 0)
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(0, 0)));
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 0),
            newResource(1, 1)));
    // required-resource = (1, 1)
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI,
        ResourceInformation.VCORES_URI), resourceCalculator
        .getInsufficientResourceNames(newResource(1, 1), newResource(0, 0)));
    assertEquals(ImmutableSet.of(ResourceInformation.MEMORY_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(0, 1)));
    assertEquals(ImmutableSet.of(ResourceInformation.VCORES_URI),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(1, 0)));
    assertEquals(ImmutableSet.of(),
        resourceCalculator.getInsufficientResourceNames(newResource(1, 1),
            newResource(1, 1)));
  }
}