@Test
public void testSetFairShare() {

  FSQueueMetrics metrics = setupMetrics(RESOURCE_NAME);
  Resource res = Resource.newInstance(2048L, 4, ImmutableMap.of(RESOURCE_NAME,
      20L));
  metrics.setFairShare(res);
  assertEquals(getErrorMessage("fairShareMB"),
      2048L, metrics.getFairShareMB());
  assertEquals(getErrorMessage("fairShareVcores"),
      4L, metrics.getFairShareVirtualCores());
  assertEquals(getErrorMessage("fairShareMB"),
      2048L, metrics.getFairShare().getMemorySize());
  assertEquals(getErrorMessage("fairShareVcores"),
      4L, metrics.getFairShare().getVirtualCores());
  assertEquals(getErrorMessage("fairShare for resource: " + RESOURCE_NAME),
      20L, metrics.getFairShare().getResourceValue(RESOURCE_NAME));
  res = Resource.newInstance(2049L, 5);
  metrics.setFairShare(res);
  assertEquals(getErrorMessage("fairShareMB"),
      2049L, metrics.getFairShareMB());
  assertEquals(getErrorMessage("fairShareVcores"),
      5L, metrics.getFairShareVirtualCores());
  assertEquals(getErrorMessage("fairShareMB"),
      2049L, metrics.getFairShare().getMemorySize());
  assertEquals(getErrorMessage("fairShareVcores"),
      5L, metrics.getFairShare().getVirtualCores());
  assertEquals(getErrorMessage("fairShare for resource: " + RESOURCE_NAME),
      0, metrics.getFairShare().getResourceValue(RESOURCE_NAME));
}