use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenCompose_whenActionThrowsException.
@Test
public void thenCompose_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
future.thenCompose(v -> {
throw new ExpectedRuntimeException();
}).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenRunAsync_exceptional.
@Test
public void thenRunAsync_exceptional() {
CompletableFuture<Object> future = newCompletableFuture(true, 1000L);
CompletableFuture<Void> chained = future.thenRunAsync(CompletableFutureTestUtil::ignore);
assertTrueEventually(() -> assertTrue(chained.isDone()));
assertTrue(chained.isCompletedExceptionally());
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
chained.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method acceptEitherAsync_whenExecutionRejected.
@Test
public void acceptEitherAsync_whenExecutionRejected() {
CompletableFuture<Object> future = newCompletableFuture(false, 0L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(RejectedExecutionException.class));
future.acceptEitherAsync(newCompletedFuture(null), v -> ignore(), REJECTING_EXECUTOR).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenAcceptAsync_exceptional.
@Test
public void thenAcceptAsync_exceptional() {
CompletableFuture<Object> future = newCompletableFuture(true, 1000L);
CompletableFuture<Void> chained = future.thenAcceptAsync(value -> ignore());
assertTrueEventually(() -> assertTrue(chained.isDone()));
assertTrue(chained.isCompletedExceptionally());
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
chained.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method runAfterEitherAsync_whenExecutionRejected.
@Test
public void runAfterEitherAsync_whenExecutionRejected() {
CompletableFuture<Object> future = newCompletableFuture(false, 0L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(RejectedExecutionException.class));
future.runAfterEitherAsync(newCompletedFuture(null), () -> ignore(), REJECTING_EXECUTOR).join();
}
Aggregations