We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retryIf(BooleanSupplier)
If I'm not mistaken, the Retryer assumes that our boolean logic always depends on the return of the Callable. But what if it didn't?
A workaround could be to have the Predicate to simply ignore its parameter:
Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder() .retryIfResult( (ignored) -> { return myBooleanLogic(); } ) ...
Or, better, give the user the option to build a Retryer that takes a BooleanSupplier.
BooleanSupplier myBS; Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder() .retryIf(myBS) // **** new RetryerBuilder.retryIf .retryIfResult(Predicates.<Boolean>isNull()) .retryIfExceptionOfType(IOException.class) .retryIfRuntimeException() .withStopStrategy(StopStrategies.stopAfterAttempt(3)) .build();
It doesn't need to be "either a Predicate or a BooleanSupplier": I think it should be legal to build a Retryer with both:
public V call(Callable<V> callable) throws ExecutionException, RetryException { .... if (!rejectionPredicate.apply(attempt)) { return attempt.get(); } if (!retryBooleanSupplier.getAsBoolean()){ // <--- return attempt.get(); } ...
I want to keep clicking on the 'refresh' button until some other element changes, e.g. the text of a div changes to "LOADED".
Here:
refreshBtn.click();
div.getText().contains("LOADED");
=> the predicate does not depend on the return of the Callable
If you agree with this I'll try to submit a PR. Thanks
The text was updated successfully, but these errors were encountered:
I would propose you implement a StopStrategy instead of adding a retryIf method.
StopStrategy
retryIf
Sorry, something went wrong.
No branches or pull requests
If I'm not mistaken, the Retryer assumes that our boolean logic always depends on the return of the Callable.
But what if it didn't?
A workaround could be to have the Predicate to simply ignore its parameter:
Or, better, give the user the option to build a Retryer that takes a BooleanSupplier.
It doesn't need to be "either a Predicate or a BooleanSupplier": I think it should be legal to build a Retryer with both:
Use case (Selenium UI testing)
I want to keep clicking on the 'refresh' button until some other element changes, e.g. the text of a div changes to "LOADED".
Here:
=> the predicate does not depend on the return of the Callable
If you agree with this I'll try to submit a PR.
Thanks
The text was updated successfully, but these errors were encountered: