@Test(expected = IntentionalException.class) public void exceptionalResult(final TestContext testContext) { final IntentionalException e = new IntentionalException(); final Async async = testContext.async(); final CompletableFuture<Integer> future = exceptionHandler.applyExceptionHandling(delayedException(125, e), webContext); future.thenAccept(i -> { assertThat(i, is(nullValue())); assertThat(thrown.get(), is(e)); async.complete(); }); }
@Override public CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext) { return future.handle((v, t) -> { if (t != null) { webContext.getExecutionContext().runOnContext(ExceptionSoftener.softenRunnable(() -> { throw t; })); return null; } else { return v; } }); }
DefaultAsyncExceptionHandler implements AsyncExceptionHandler<T> { @Override public CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext) { return future.handle((v, t) -> { if (t != null) { webContext.getExecutionContext().runOnContext(ExceptionSoftener.softenRunnable(() -> { throw t; })); return null; } else { return v; } }); } }
DefaultAsyncExceptionHandler implements AsyncExceptionHandler<T> { @Override public CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext) { return future.handle((v, t) -> { if (t != null) { webContext.getExecutionContext().runOnContext(ExceptionSoftener.softenRunnable(() -> { throw t; })); return null; } else { return v; } }); }  }
DefaultAsyncExceptionHandler implements AsyncExceptionHandler<T> { @Override public CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext) { return future.handle((v, t) -> { if (t != null) { webContext.getExecutionContext().runOnContext(ExceptionSoftener.softenRunnable(() -> { throw t; })); return null; } else { return v; } }); }  @Override CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext); }
DefaultAsyncExceptionHandler implements AsyncExceptionHandler<T> { @Override public CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext) { return future.handle((v, t) -> { if (t != null) { webContext.getExecutionContext().runOnContext(ExceptionSoftener.softenRunnable(() -> { throw t; })); return null; } else { return v; } }); }  @Override CompletableFuture<T> applyExceptionHandling(CompletableFuture<T> future, AsyncWebContext webContext);  }