HealthCheckRegistry { public HealthCheck.Result runHealthCheck(String name) throws NoSuchElementException { final HealthCheck healthCheck = healthChecks.get(name); if (healthCheck == null) { throw new NoSuchElementException("No health check named " + name + " exists"); } return healthCheck.execute(); } HealthCheckRegistry();  HealthCheckRegistry(int asyncExecutorPoolSize);  HealthCheckRegistry(ScheduledExecutorService asyncExecutorService); void addListener(HealthCheckRegistryListener listener); void removeListener(HealthCheckRegistryListener listener); void register(String name, HealthCheck healthCheck); void unregister(String name); SortedSet<String> getNames(); HealthCheck getHealthCheck(String name); HealthCheck.Result runHealthCheck(String name); SortedMap<String, HealthCheck.Result> runHealthChecks(); SortedMap<String, HealthCheck.Result> runHealthChecks(HealthCheckFilter filter); SortedMap<String, HealthCheck.Result> runHealthChecks(ExecutorService executor); SortedMap<String, HealthCheck.Result> runHealthChecks(ExecutorService executor, HealthCheckFilter filter); void shutdown();  }
@Test public void runsHealthChecksByName() { assertThat(registry.runHealthCheck("hc1")).isEqualTo(r1); }
@Test public void doesNotRunNonexistentHealthChecks() { try { registry.runHealthCheck("what"); failBecauseExceptionWasNotThrown(NoSuchElementException.class); } catch (NoSuchElementException e) { assertThat(e.getMessage()) .isEqualTo("No health check named what exists"); } }