AsyncHealthCheckDecorator extends HealthCheck implements Runnable { public HealthCheck getHealthCheck() { return healthCheck; } AsyncHealthCheckDecorator(HealthCheck healthCheck, ScheduledExecutorService executorService, Clock clock);   AsyncHealthCheckDecorator(HealthCheck healthCheck, ScheduledExecutorService executorService); @Override void run(); HealthCheck getHealthCheck();  }
@Test public void fixedDelayAsyncHealthCheckTriggersSuccessfulInstantiationWithFixedDelay() throws Exception { HealthCheck asyncHealthCheck = new FixedDelayAsyncHealthCheck(); AsyncHealthCheckDecorator asyncDecorator = new AsyncHealthCheckDecorator(asyncHealthCheck, mockExecutorService); verify(mockExecutorService, times(1)).scheduleWithFixedDelay(any(Runnable.class), eq(0L), eq(1L), eq(TimeUnit.SECONDS)); assertThat(asyncDecorator.getHealthCheck()).isEqualTo(asyncHealthCheck); }