@Test public void managedInvocationTestWithException() { final CompletableFuture<Integer> future = managedService.asyncTaskWithException(1); try { future.get(200, TimeUnit.MILLISECONDS); } catch (ExecutionException e) { assertEquals("Planned exception", e.getCause().getMessage()); } catch (Exception e) { fail("Unexpected exception" + e); } }
public CompletableFuture<Integer> asyncTaskWithException(final int value) { LOGGER.info("Create asyncTaskWithException"); return CompletableFuture .supplyAsync(longTask(value, 100, "Planned exception"), executor) .thenApply(i -> i + 1); }
ManagedService { public CompletableFuture<Integer> asyncTaskWithException(final int value) { LOGGER.info("Create asyncTaskWithException"); return CompletableFuture .supplyAsync(longTask(value, 100, "Planned exception"), executor) .thenApply(i -> i + 1); } }
ManagedService { public CompletableFuture<Integer> asyncTaskWithException(final int value) { LOGGER.info("Create asyncTaskWithException"); return CompletableFuture .supplyAsync(longTask(value, 100, "Planned exception"), executor) .thenApply(i -> i + 1); }  }
ManagedService { public CompletableFuture<Integer> asyncTaskWithException(final int value) { LOGGER.info("Create asyncTaskWithException"); return CompletableFuture .supplyAsync(longTask(value, 100, "Planned exception"), executor) .thenApply(i -> i + 1); }  CompletableFuture<Integer> asyncTask(final int value); CompletableFuture<Integer> asyncTaskWithException(final int value); }
ManagedService { public CompletableFuture<Integer> asyncTaskWithException(final int value) { LOGGER.info("Create asyncTaskWithException"); return CompletableFuture .supplyAsync(longTask(value, 100, "Planned exception"), executor) .thenApply(i -> i + 1); }  CompletableFuture<Integer> asyncTask(final int value); CompletableFuture<Integer> asyncTaskWithException(final int value);  }