use of org.assertj.core.error.future.Warning.WARNING in project assertj-core by joel-costigliola.
the class CompletableFutureAssert_isCompletedWithValueMatching_Test method should_fail_if_completable_future_has_failed.
@Test
public void should_fail_if_completable_future_has_failed() {
// GIVEN
CompletableFuture<String> future = new CompletableFuture<>();
future.completeExceptionally(new RuntimeException());
// WHEN
Throwable throwable = catchThrowable(() -> assertThat(future).isCompletedWithValueMatching(result -> result.equals("done")));
// THEN
assertThat(throwable).isInstanceOf(AssertionError.class).hasMessageStartingWith(format("%nExpecting%n <CompletableFuture[Failed: java.lang.RuntimeException]%n")).hasMessageContaining("Caused by: java.lang.RuntimeException").hasMessageEndingWith(format("to be completed.%n%s", WARNING));
}
Aggregations