handle(Class) accepts Throwable, however run(RunnableRetry) catches only Exception. So the following statement will not retry:
retry(3)
.delay(Duration.ofMillis(500))
.handle(AssertionError.class)
.run(() -> {
get("/eventually/consistent/resources")
.then()
.statusCode(200);
});
Catching Error is not recommended in most cases, but in this case it will help to make the framework useful in unit tests.
handle(Class)acceptsThrowable, howeverrun(RunnableRetry)catches onlyException. So the following statement will not retry:Catching
Erroris not recommended in most cases, but in this case it will help to make the framework useful in unit tests.