All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.springboot.cucumber.rest.Awaiter.mustache Maven / Gradle / Ivy

There is a newer version: 1.18.1
Show newest version
package {{packageName}}.cucumber.rest;

import java.time.Duration;
import org.assertj.core.api.SoftAssertionsProvider.ThrowingRunnable;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionFactory;

final class Awaiter {

  private Awaiter() {}

  static void await(Duration maxTime, ThrowingRunnable assertion) {
    awaiter(maxTime).untilAsserted(() -> {
      try {
        assertion.run();
      } catch (AssertionError e) {
        CucumberRestTestContext.retry();

        assertion.run();
      }
    });
  }

  private static ConditionFactory awaiter(Duration maxTime) {
    return Awaitility.await().pollDelay(Duration.ofMillis(0)).pollInterval(Duration.ofMillis(20)).atMost(maxTime);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy