@VisibleForTesting
  String getResources(ContainerInfo container) {
    Map<String, Long> allocatedResources = container.getAllocatedResources();

    StringBuilder sb = new StringBuilder();
    sb.append(getResourceAsString(ResourceInformation.MEMORY_URI,
        allocatedResources.get(ResourceInformation.MEMORY_URI))).append(", ");
    sb.append(getResourceAsString(ResourceInformation.VCORES_URI,
        allocatedResources.get(ResourceInformation.VCORES_URI)));

    if (container.hasCustomResources()) {
      container.getAllocatedResources().forEach((key, value) -> {
        if (!key.equals(ResourceInformation.MEMORY_URI) &&
            !key.equals(ResourceInformation.VCORES_URI)) {
          sb.append(", ");
          sb.append(getResourceAsString(key, value));
        }
      });
    }

    return sb.toString();
  }
@Test
  public void testRenderResourcesString() {
    CustomResourceTypesConfigurationProvider.
        initResourceTypes(ResourceInformation.GPU_URI);

    Resource resource = ResourceTypesTestHelper.newResource(
        DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
        DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
        ImmutableMap.<String, String>builder()
            .put(ResourceInformation.GPU_URI, "5").build());

    ContainerBlock block = new ContainerBlock(
        mock(ApplicationBaseProtocol.class),
        mock(View.ViewContext.class));

    ContainerReport containerReport = createContainerReport();
    containerReport.setAllocatedResource(resource);
    ContainerInfo containerInfo = new ContainerInfo(containerReport);
    String resources = block.getResources(containerInfo);

    Assert.assertEquals("8192 Memory, 4 VCores, 5 yarn.io/gpu", resources);
  }