@VisibleForTesting
    Optional<Set<String>> getSchedulerResourceTypeNamesUnsafe(final Object response) {
        if (getSchedulerResourceTypesMethod.isPresent() && response != null) {
            try {
                @SuppressWarnings("unchecked")
                final Set<? extends Enum> schedulerResourceTypes =
                        (Set<? extends Enum>)
                                getSchedulerResourceTypesMethod.get().invoke(response);
                return Optional.of(
                        Preconditions.checkNotNull(schedulerResourceTypes).stream()
                                .map(Enum::name)
                                .collect(Collectors.toSet()));
            } catch (Exception e) {
                logger.error("Error invoking 'getSchedulerResourceTypes()'", e);
            }
        }

        return Optional.empty();
    }
@Test
    void testCallsGetSchedulerResourceTypesMethodIfPresent() {
        final RegisterApplicationMasterResponseReflector
                registerApplicationMasterResponseReflector =
                        new RegisterApplicationMasterResponseReflector(LOG, HasMethod.class);

        final Optional<Set<String>> schedulerResourceTypeNames =
                registerApplicationMasterResponseReflector.getSchedulerResourceTypeNamesUnsafe(
                        new HasMethod());

        assertThat(schedulerResourceTypeNames).isPresent();
        assertThat(schedulerResourceTypeNames.get()).contains("MEMORY", "CPU");
    }