static TaskExecutorResourceSpec resourceSpecFromConfig(Configuration config) {
        try {
            checkTaskExecutorResourceConfigSet(config);
        } catch (IllegalConfigurationException e) {
            throw new IllegalConfigurationException("Failed to create TaskExecutorResourceSpec", e);
        }
        return new TaskExecutorResourceSpec(
                new CPUResource(config.get(TaskManagerOptions.CPU_CORES)),
                config.get(TaskManagerOptions.TASK_HEAP_MEMORY),
                config.get(TaskManagerOptions.TASK_OFF_HEAP_MEMORY),
                config.get(TaskManagerOptions.NETWORK_MEMORY_MIN),
                config.get(TaskManagerOptions.MANAGED_MEMORY_SIZE),
                ExternalResourceUtils.getExternalResourcesCollection(config));
    }
@Test
    void testResourceSpecFromConfigFailsIfRequiredOptionIsNotSet() {
        TaskExecutorResourceUtils.CONFIG_OPTIONS.stream()
                .filter(option -> !option.hasDefaultValue())
                .forEach(
                        option -> {
                            assertThatThrownBy(
                                            () ->
                                                    TaskExecutorResourceUtils
                                                            .resourceSpecFromConfig(
                                                                    setAllRequiredOptionsExceptOne(
                                                                            option)))
                                    .isInstanceOf(IllegalConfigurationException.class);
                        });
    }