@Test
public void testSetMinShare() {

  FSQueueMetrics metrics = setupMetrics(RESOURCE_NAME);
  Resource res = Resource.newInstance(2048L, 4, ImmutableMap.of(RESOURCE_NAME,
      20L));
  metrics.setMinShare(res);
  assertEquals(getErrorMessage("minShareMB"),
      2048L, metrics.getMinShareMB());
  assertEquals(getErrorMessage("minShareVcores"),
      4L, metrics.getMinShareVirtualCores());
  assertEquals(getErrorMessage("minShareMB"),
      2048L, metrics.getMinShare().getMemorySize());
  assertEquals(getErrorMessage("minShareVcores"),
      4L, metrics.getMinShare().getVirtualCores());
  assertEquals(getErrorMessage("minShare for resource: " + RESOURCE_NAME),
      20L, metrics.getMinShare().getResourceValue(RESOURCE_NAME));
  res = Resource.newInstance(2049L, 5);
  metrics.setMinShare(res);
  assertEquals(getErrorMessage("minShareMB"),
      2049L, metrics.getMinShareMB());
  assertEquals(getErrorMessage("minShareVcores"),
      5L, metrics.getMinShareVirtualCores());
  assertEquals(getErrorMessage("minShareMB"),
      2049L, metrics.getMinShare().getMemorySize());
  assertEquals(getErrorMessage("minShareVcores"),
      5L, metrics.getMinShare().getVirtualCores());
  assertEquals(getErrorMessage("minShare for resource: " + RESOURCE_NAME),
      0, metrics.getMinShare().getResourceValue(RESOURCE_NAME));
}