use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenCombine_whenActionThrowsException.
@Test
public void thenCombine_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
future.thenCombine(newCompletedFuture(null), (t, u) -> {
throw new ExpectedRuntimeException();
}).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method whenCompleteAsync_whenExecutionRejected.
@Test
public void whenCompleteAsync_whenExecutionRejected() {
CompletableFuture<Object> future = newCompletableFuture(false, 0L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(RejectedExecutionException.class));
future.whenCompleteAsync((v, t) -> ignore(), REJECTING_EXECUTOR).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenAcceptBoth_whenActionThrowsException.
@Test
public void thenAcceptBoth_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
future.thenAcceptBoth(newCompletedFuture(null), (v, u) -> {
throw new ExpectedRuntimeException();
}).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method applyToEither_whenActionThrowsException.
@Test
public void applyToEither_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
CompletableFuture<Long> nextStage = future.applyToEither(new CompletableFuture<Long>(), (v) -> {
throw new ExpectedRuntimeException();
});
assertTrueEventually(() -> assertTrue(nextStage.isDone()));
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
nextStage.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method runAfterEither_whenActionThrowsException.
@Test
public void runAfterEither_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
future.runAfterEither(newCompletedFuture(null), () -> {
throw new ExpectedRuntimeException();
}).join();
}
Aggregations