### Question:
DefaultCompletableAsyncCompletion implements CompletableAsyncCompletion { @Override public void join() throws CompletionException, InterruptedException { try { join(10, TimeUnit.SECONDS); } catch (TimeoutException ex) { throw new RuntimeException("Default timeout triggered for blocking call to AsyncCompletion::join()", ex); } } DefaultCompletableAsyncCompletion();   DefaultCompletableAsyncCompletion(CompletableFuture<Void> future); @Override boolean complete(); @Override boolean completeExceptionally(Throwable ex); @Override boolean cancel(); @Override boolean isDone(); @Override boolean isCompletedExceptionally(); @Override boolean isCancelled(); @Override void join(); @Override void join(long timeout, TimeUnit unit); @Override AsyncResult<U> then(Supplier<? extends AsyncResult<U>> fn); @Override AsyncResult<U> thenSchedule(Vertx vertx, Supplier<? extends AsyncResult<U>> fn); @Override AsyncCompletion thenCompose(Supplier<? extends AsyncCompletion> fn); @Override AsyncCompletion thenRun(Runnable action); @Override AsyncCompletion thenScheduleRun(Vertx vertx, Runnable runnable); @Override AsyncCompletion thenScheduleBlockingRun(Vertx vertx, Runnable runnable); @Override AsyncCompletion thenScheduleBlockingRun(WorkerExecutor executor, Runnable runnable); @Override AsyncResult<U> thenSupply(Supplier<? extends U> supplier); @Override AsyncResult<U> thenSupply(Vertx vertx, Supplier<? extends U> supplier); @Override AsyncCompletion thenConsume(AsyncResult<? extends U> other, Consumer<? super U> consumer); @Override AsyncResult<V> thenApply(AsyncResult<? extends U> other, Function<? super U, ? extends V> fn); @Override AsyncCompletion thenCombine(AsyncCompletion other); @Override AsyncCompletion exceptionally(Consumer<? super Throwable> consumer); @Override AsyncCompletion whenComplete(Consumer<? super Throwable> consumer); @Override AsyncResult<U> handle(Function<? super Throwable, ? extends U> fn); @Override AsyncCompletion accept(Consumer<? super Throwable> consumer); @Override CompletableFuture<Void> toFuture();  }### Answer:
@Test void testExecutingBlocking() throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); AsyncCompletion completion = AsyncCompletion.executeBlocking(() -> executed.set(true)); completion.join(); assertTrue(executed.get()); }
@Test void testExecutingBlocking(@VertxInstance Vertx vertx) throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); AsyncCompletion completion = AsyncCompletion.executeBlocking(vertx, () -> executed.set(true)); completion.join(); assertTrue(executed.get()); }
@Test void testRunOnContextSupplier(@VertxInstance Vertx vertx) throws InterruptedException { AsyncCompletion completion = AsyncCompletion.runOnContext(vertx, AsyncCompletion::completed); completion.join(); }
@Test void testRunOnContext(@VertxInstance Vertx vertx) throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); AsyncCompletion completion = AsyncCompletion.runOnContext(vertx, () -> executed.set(true)); completion.join(); assertTrue(executed.get()); }
@Test void testRunOnWorker(@VertxInstance Vertx vertx) throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); WorkerExecutor executor = vertx.createSharedWorkerExecutor("foo"); AsyncCompletion completion = AsyncCompletion.executeBlocking(executor, () -> executed.set(true)); completion.join(); assertTrue(executed.get()); }
@Test void testRunOnContextWithCompletion(@VertxInstance Vertx vertx) throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); AsyncCompletion completion = AsyncCompletion.runOnContext(vertx, () -> { executed.set(true); return AsyncCompletion.completed(); }); completion.join(); assertTrue(executed.get()); }
@Test void testRunOnExecutor() throws InterruptedException { AtomicReference<Boolean> executed = new AtomicReference<>(); ExecutorService service = Executors.newSingleThreadExecutor(); AsyncCompletion completion = AsyncCompletion.executeBlocking(service, () -> executed.set(true)); completion.join(); assertTrue(executed.get()); service.shutdown(); }