@Test
public void testConvertResourceWithCustomResource() {

  initResourceTypes();
  Resource res = Resource.newInstance(4096, 12,
      ImmutableMap.of(CUSTOM_RESOURCE_NAME, 20L));
  org.apache.hadoop.yarn.service.api.records.Resource serviceResource =
      SubmarineResourceUtils.convertYarnResourceToServiceResource(res);
  assertEquals(12, serviceResource.getCpus().intValue());
  assertEquals(4096, (int) Integer.valueOf(serviceResource.getMemory()));
  Map<String, ResourceInformation> additionalResources =
      serviceResource.getAdditional();
  // Additional resources also includes vcores and memory
  assertEquals(3, additionalResources.size());
  ResourceInformation customResourceRI =
      additionalResources.get(CUSTOM_RESOURCE_NAME);
  assertEquals("G", customResourceRI.getUnit());
  assertEquals(20L, (long) customResourceRI.getValue());
}