@Test(expected = TimeoutException.class) public void managedInvocationTestWithTimeout() throws InterruptedException, ExecutionException, TimeoutException { final CompletableFuture<Integer> future = managedService.asyncTask(1); future.get(10, TimeUnit.MILLISECONDS); }
public CompletableFuture<Integer> asyncTask(final int value) { LOGGER.info("Create asyncTask"); return CompletableFuture .supplyAsync(longTask(value, 100, null), executor) .thenApply(i -> i + 1); }
ManagedService { public CompletableFuture<Integer> asyncTask(final int value) { LOGGER.info("Create asyncTask"); return CompletableFuture .supplyAsync(longTask(value, 100, null), executor) .thenApply(i -> i + 1); } }
ManagedService { public CompletableFuture<Integer> asyncTask(final int value) { LOGGER.info("Create asyncTask"); return CompletableFuture .supplyAsync(longTask(value, 100, null), executor) .thenApply(i -> i + 1); }  }
ManagedService { public CompletableFuture<Integer> asyncTask(final int value) { LOGGER.info("Create asyncTask"); return CompletableFuture .supplyAsync(longTask(value, 100, null), executor) .thenApply(i -> i + 1); }  CompletableFuture<Integer> asyncTask(final int value); CompletableFuture<Integer> asyncTaskWithException(final int value); }
ManagedService { public CompletableFuture<Integer> asyncTask(final int value) { LOGGER.info("Create asyncTask"); return CompletableFuture .supplyAsync(longTask(value, 100, null), executor) .thenApply(i -> i + 1); }  CompletableFuture<Integer> asyncTask(final int value); CompletableFuture<Integer> asyncTaskWithException(final int value);  }