@Test
public void testCalculateMinShareRatios() {

  Map<String, Integer> index = ResourceUtils.getResourceTypeIndex();
  Resource used = Resources.createResource(10, 5);
  Resource minShares = Resources.createResource(5, 10);
  float[][] ratios = new float[3][3];
  DominantResourceFairnessComparatorN comparator =
      new DominantResourceFairnessComparatorN();
  used.setResourceValue("test", 2L);
  minShares.setResourceValue("test", 0L);
  comparator.calculateMinShareRatios(used, minShares, ratios);
  assertEquals("Calculated min share ratio for memory (10MB out of 5MB) is "
      + "incorrect", 2.0,
      ratios[index.get(ResourceInformation.MEMORY_MB.getName())][2], .00001f);
  assertEquals("Calculated min share ratio for vcores (5 out of 10) is "
      + "incorrect", 0.5,
      ratios[index.get(ResourceInformation.VCORES.getName())][2], .00001f);
  assertEquals("Calculated min share ratio for test resource (0 out of 5) is "
      + "incorrect", Float.POSITIVE_INFINITY, ratios[index.get("test")][2],
      0.00001f);
}