HealthCheckRegistry { public SortedMap<String, HealthCheck.Result> runHealthChecks() { return runHealthChecks(HealthCheckFilter.ALL); } 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 runsRegisteredHealthChecks() { final Map<String, HealthCheck.Result> results = registry.runHealthChecks(); assertThat(results).contains(entry("hc1", r1)); assertThat(results).contains(entry("hc2", r2)); assertThat(results).containsKey("ahc"); }
@Test public void runsRegisteredHealthChecksWithFilter() { final Map<String, HealthCheck.Result> results = registry.runHealthChecks((name, healthCheck) -> "hc1".equals(name)); assertThat(results).containsOnly(entry("hc1", r1)); }
@Test public void runsRegisteredHealthChecksWithNonMatchingFilter() { final Map<String, HealthCheck.Result> results = registry.runHealthChecks((name, healthCheck) -> false); assertThat(results).isEmpty(); }