### Question:
HealthCheckGauge implements Gauge<Integer> { @Override public Integer getValue() { final HealthCheck.Result result = registry.runHealthCheck(name); return result.isHealthy() ? 1 : 0; } HealthCheckGauge(final HealthCheckRegistry registry, final String name); @Override Integer getValue();  }### Answer:
@Test public void testHealthy() throws Exception { when(registry.runHealthCheck(anyString())).thenReturn(HealthCheck.Result.healthy()); final HealthCheckGauge gauge = new HealthCheckGauge(registry, "foo"); assertThat(gauge.getValue(), equalTo(1)); }
@Test public void testUnhealthy() throws Exception { when(registry.runHealthCheck(anyString())).thenReturn(HealthCheck.Result.unhealthy("meh")); final HealthCheckGauge gauge = new HealthCheckGauge(registry, "foo"); assertThat(gauge.getValue(), equalTo(0)); }