### Question:
AsynchronousTimeoutBean { @Asynchronous public Future<Boolean> timeout(boolean shouldTimeout) { Boolean timedOut = false; if (shouldTimeout) { try { Thread.sleep(AWAIT); } catch (InterruptedException ex) { timedOut = true; } } return CompletableFuture.completedFuture(timedOut); }  @Asynchronous Future<Boolean> timeout(boolean shouldTimeout); static final long AWAIT; }### Answer:
@Test public void timeoutTest() throws InterruptedException, ExecutionException { Future<Boolean> future = asynchronousTimeoutBean.timeout(true); try { future.get(); } catch (TimeoutException toe) { return; } catch (ExecutionException ex) { if (ex.getCause() instanceof TimeoutException) { return; } } Assert.fail(); }