### Question:
DockerDaemonHealthChecker extends HealthCheck { @Override protected Result check() throws Exception { try { dockerClient.ping(); return Result.healthy(); } catch (final Exception ex) { return Result.unhealthy(ex); } } DockerDaemonHealthChecker(final DockerClient dockerClient);   }### Answer:
@Test public void testHealthy() throws Exception { final HealthCheck.Result result = sut.check(); assertThat(result.isHealthy(), is(true)); }
@Test public void testUnhealthy() throws Exception { when(dockerClient.ping()) .thenThrow(new DockerRequestException("GET", new URI("/ping"), 500, null, null)); final HealthCheck.Result result = sut.check(); assertThat(result.isHealthy(), is(false)); }