ServerChecker { public void checkOnce(Consumer<String> readinessHandler) throws InfrastructureException { if (!isAvailable()) { throw new InfrastructureException( String.format("Server '%s' in container '%s' not available.", serverRef, machineName)); } readinessHandler.accept(serverRef); } protected  ServerChecker(
      String machineName,
      String serverRef,
      long period,
      long timeout,
      int successThreshold,
      TimeUnit timeUnit,
      Timer timer); void start(); void checkOnce(Consumer<String> readinessHandler); abstract boolean isAvailable(); CompletableFuture<String> getReportCompFuture();  }
@Test(expectedExceptions = InfrastructureException.class) public void checkOnceThrowsExceptionIfServerIsNotAvailable() throws InfrastructureException { new TestServerChecker("test", "test", 1, 1, 1, TimeUnit.SECONDS, null).checkOnce(ref -> {}); }