Optional<PriorityAndResource> getPriorityAndResource(
            final TaskExecutorProcessSpec taskExecutorProcessSpec) {
        tryAdaptAndAddTaskExecutorResourceSpecIfNotExist(taskExecutorProcessSpec);
        return Optional.ofNullable(
                taskExecutorProcessSpecToPriorityAndResource.get(taskExecutorProcessSpec));
    }
@Test
    void testExternalResourceFailExceedMax() {
        assumeThat(isExternalResourceSupported()).isTrue();

        assertThatThrownBy(
                        () ->
                                getAdapterWithExternalResources(
                                                SUPPORTED_EXTERNAL_RESOURCE_NAME,
                                                SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
                                        .getPriorityAndResource(
                                                TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX))
                .isInstanceOf(IllegalStateException.class);
    }