use of com.hazelcast.test.ExpectedRuntimeException 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.test.ExpectedRuntimeException 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();
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method acceptEither_whenActionThrowsException.
@Test
public void acceptEither_whenActionThrowsException() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
CompletableFuture<Void> nextStage = future.acceptEither(new CompletableFuture<>(), (v) -> {
throw new ExpectedRuntimeException();
});
assertTrueEventually(() -> assertTrue(nextStage.isDone()));
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
nextStage.join();
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenAccept_whenActionThrowsException.
private void thenAccept_whenActionThrowsException(long completionDelay) {
CompletableFuture<Object> future = newCompletableFuture(false, completionDelay);
CompletableFuture<Void> chained = future.thenAccept(value -> {
throw new ExpectedRuntimeException();
});
assertTrueEventually(() -> assertTrue(future.isDone()));
assertTrueEventually(() -> assertTrue(chained.isDone()));
assertFalse(future.isCompletedExceptionally());
assertTrue(chained.isCompletedExceptionally());
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
chained.join();
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenApply_whenActionThrowsException.
public void thenApply_whenActionThrowsException(long completionDelay) {
CompletableFuture<Object> future = newCompletableFuture(false, completionDelay);
CompletableFuture<Void> chained = future.thenApply(value -> {
throw new ExpectedRuntimeException();
});
assertTrueEventually(() -> assertTrue(future.isDone()));
assertTrueEventually(() -> assertTrue(chained.isDone()));
assertFalse(future.isCompletedExceptionally());
assertTrue(chained.isCompletedExceptionally());
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
chained.join();
}
Aggregations