@VisibleForTesting
    static Map<String, Long> getExternalResourceAmountMap(Configuration config) {
        final Set<String> resourceSet = getExternalResourceSet(config);

        if (resourceSet.isEmpty()) {
            return Collections.emptyMap();
        }

        final Map<String, Long> externalResourceAmountMap = new HashMap<>();
        for (String resourceName : resourceSet) {
            final ConfigOption<Long> amountOption =
                    key(ExternalResourceOptions.getAmountConfigOptionForResource(resourceName))
                            .longType()
                            .noDefaultValue();
            final Optional<Long> amountOpt = config.getOptional(amountOption);
            if (!amountOpt.isPresent()) {
                LOG.warn(
                        "The amount of the {} should be configured. Will ignore that resource.",
                        resourceName);
            } else if (amountOpt.get() <= 0) {
                LOG.warn(
                        "The amount of the {} should be positive while finding {}. Will ignore that resource.",
                        amountOpt.get(),
                        resourceName);
            } else {
                externalResourceAmountMap.put(resourceName, amountOpt.get());
            }
        }

        return externalResourceAmountMap;
    }
@Test
    public void testGetExternalResourceAmountMap() {
        final Configuration config = new Configuration();
        config.set(
                ExternalResourceOptions.EXTERNAL_RESOURCE_LIST,
                Collections.singletonList(RESOURCE_NAME_1));
        config.setLong(
                ExternalResourceOptions.getAmountConfigOptionForResource(RESOURCE_NAME_1),
                RESOURCE_AMOUNT_1);

        final Map<String, Long> externalResourceAmountMap =
                ExternalResourceUtils.getExternalResourceAmountMap(config);

        assertThat(externalResourceAmountMap.size(), is(1));
        assertTrue(externalResourceAmountMap.containsKey(RESOURCE_NAME_1));
        assertThat(externalResourceAmountMap.get(RESOURCE_NAME_1), is(RESOURCE_AMOUNT_1));
    }