@Test public void testOneFails() { final HealthCheckRegistry registry = new HealthCheckRegistry(); registry.register("pass1", stubHealthCheck(HealthCheck.Result.healthy())); registry.register("fail1", stubHealthCheck(HealthCheck.Result.unhealthy("error"))); final TotalHealthCheckGauge gauge = new TotalHealthCheckGauge(registry); assertThat(gauge.getValue(), is(0)); }
@Override public Integer getValue() { final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks(); return results.values().stream().allMatch(HealthCheck.Result::isHealthy) ? 1 : 0; }
TotalHealthCheckGauge implements Gauge<Integer> { @Override public Integer getValue() { final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks(); return results.values().stream().allMatch(HealthCheck.Result::isHealthy) ? 1 : 0; } }
TotalHealthCheckGauge implements Gauge<Integer> { @Override public Integer getValue() { final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks(); return results.values().stream().allMatch(HealthCheck.Result::isHealthy) ? 1 : 0; } TotalHealthCheckGauge(final HealthCheckRegistry registry); }
TotalHealthCheckGauge implements Gauge<Integer> { @Override public Integer getValue() { final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks(); return results.values().stream().allMatch(HealthCheck.Result::isHealthy) ? 1 : 0; } TotalHealthCheckGauge(final HealthCheckRegistry registry); @Override Integer getValue(); }
TotalHealthCheckGauge implements Gauge<Integer> { @Override public Integer getValue() { final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks(); return results.values().stream().allMatch(HealthCheck.Result::isHealthy) ? 1 : 0; } TotalHealthCheckGauge(final HealthCheckRegistry registry); @Override Integer getValue();  }