public void setSteadyFairShare(Resource resource) {
    steadyFairShareMB.set(resource.getMemorySize());
    steadyFairShareVCores.set(resource.getVirtualCores());
    if (customResources != null) {
      customResources.setSteadyFairShare(resource);
    }
  }
@Test
  public void testSetSteadyFairShare() {
    FSQueueMetrics metrics = setupMetrics(RESOURCE_NAME);

    Resource res = Resource.newInstance(2048L, 4, ImmutableMap.of(RESOURCE_NAME,
        20L));
    metrics.setSteadyFairShare(res);

    assertEquals(getErrorMessage("steadyFairShareMB"),
        2048L, metrics.getSteadyFairShareMB());
    assertEquals(getErrorMessage("steadyFairShareVcores"),
        4L, metrics.getSteadyFairShareVCores());

    Resource steadyFairShare = metrics.getSteadyFairShare();
    assertEquals(getErrorMessage("steadyFairShareMB"),
        2048L, steadyFairShare.getMemorySize());
    assertEquals(getErrorMessage("steadyFairShareVcores"),
        4L, steadyFairShare.getVirtualCores());
    assertEquals(getErrorMessage("steadyFairShare for resource: " +
            RESOURCE_NAME),
        20L, steadyFairShare.getResourceValue(RESOURCE_NAME));

    res = Resource.newInstance(2049L, 5);
    metrics.setSteadyFairShare(res);

    assertEquals(getErrorMessage("steadyFairShareMB"),
        2049L, metrics.getSteadyFairShareMB());
    assertEquals(getErrorMessage("steadyFairShareVcores"),
        5L, metrics.getSteadyFairShareVCores());

    steadyFairShare = metrics.getSteadyFairShare();
    assertEquals(getErrorMessage("steadyFairShareMB"),
        2049L, steadyFairShare.getMemorySize());
    assertEquals(getErrorMessage("steadyFairShareVcores"),
        5L, steadyFairShare.getVirtualCores());
    assertEquals(getErrorMessage("steadyFairShare for resource: " +
            RESOURCE_NAME),
        0, steadyFairShare.getResourceValue(RESOURCE_NAME));
  }