@Override
    public void onStateChanged(final String name, final boolean isNowHealthy) {
        LOGGER.debug("health check changed state: name={} state={}", name, isNowHealthy);
        final ScheduledHealthCheck check = checks.get(name);

        if (check == null) {
            LOGGER.error("State changed for unconfigured health check: name={} state={}", name, isNowHealthy);
            return;
        }

        if (check.isCritical()) {
            handleCriticalHealthChange(check, isNowHealthy);
        } else {
            handleNonCriticalHealthChange(check, isNowHealthy);
        }

        scheduler.schedule(check, isNowHealthy);

        healthStateListeners.forEach(listener -> {
            try {
                listener.onStateChanged(name, isNowHealthy);
            } catch (final RuntimeException e) {
                LOGGER.warn("Exception thrown for healthCheckName: {} from Health State listener onStateChanged: {}",
                    name, listener, e);
                // swallow error
            }
        });
        healthStateListeners.forEach(listener -> listener.onStateChanged(name, isNowHealthy));
    }
@Test
    void shouldDoNothingWhenStateChangesForUnconfiguredHealthCheck() {
        // given
        final HealthCheckManager manager = new HealthCheckManager(Collections.emptyList(), scheduler,
            new MetricRegistry(), SHUTDOWN_WAIT, true, Collections.emptyList());

        // when
        manager.onStateChanged(NAME, false);

        // then
        verifyNoInteractions(scheduler);
    }