-
-
Notifications
You must be signed in to change notification settings - Fork 249
Open
Description
I am looking to do the following assertion:
final ThreadTestEnv env = new ThreadTestEnv();
...
await()
.atMost(10, TimeUnit.SECONDS)
.onFailure(env::printErrors)
.untilAsserted(() -> {
final Set<Object> values = runQuery();
assertThat(values).containsExactlyInAnyOrder("notThere");
});
With the onFailure
code evaluating a single time when reaching the assertion timeout.
It possible to do so, but not with the fluent API: #258 (comment)
The workaround being:
await()
.atMost(10, TimeUnit.SECONDS)
.conditionEvaluationListener(new ConditionEvaluationListener<>() {
@Override
public void onTimeout(TimeoutEvent timeoutEvent) {
env.printErrors();
}
@Override
public void conditionEvaluated(EvaluatedCondition<Object> condition) {
}
})
.untilAsserted(() -> {
final Set<Object> values = runQuery();
assertThat(values).containsExactlyInAnyOrder("notThere");
});
It is a feature that as almost been asked twice, but with some workaround:
Metadata
Metadata
Assignees
Labels
No labels