### Question:
AsyncCompletionStage extends FiberAsync<V, ExecutionException> { public static <V> V get(CompletionStage<V> future) throws ExecutionException, InterruptedException, SuspendExecution { if (Fiber.isCurrentFiber()) return new AsyncCompletionStage<V>(future).run(); else return future.toCompletableFuture().get(); } private  AsyncCompletionStage(CompletionStage<V> future); static V get(CompletionStage<V> future); static V get(CompletionStage<V> future, long timeout, TimeUnit unit); static V get(CompletionStage<V> future, Timeout timeout);  }### Answer:
@Test public void simpleTest1() throws Exception { final CompletableFuture<String> fut = new CompletableFuture<String>(); final Fiber<String> fiber = new Fiber<>(scheduler, () -> { try { return AsyncCompletionStage.get(fut); } catch (ExecutionException e) { throw new RuntimeException(e); } }).start(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(200); fut.complete("hi!"); } catch (InterruptedException e) { } } }).start(); assertThat(fiber.get(), equalTo("hi!")); }
@Test public void testException() throws Exception { final CompletableFuture<String> fut = new CompletableFuture<String>(); final Fiber<String> fiber = new Fiber<>(scheduler, () -> { try { String res = AsyncCompletionStage.get(fut); fail(); return res; } catch (ExecutionException e) { throw Exceptions.rethrow(e.getCause()); } }).start(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(200); fut.completeExceptionally(new RuntimeException("haha!")); } catch (InterruptedException e) { } } }).start(); try { fiber.get(); fail(); } catch (ExecutionException e) { assertThat(e.getCause().getMessage(), equalTo("haha!")); } }