@@ -0,0 +1,1164 @@
+package com.millross.blog.async;%0A%0Aimport org.junit.Test;%0A%0Aimport java.util.Optional;%0Aimport java.util.concurrent.CompletableFuture;%0Aimport java.util.concurrent.CompletionException;%0Aimport java.util.concurrent.atomic.AtomicReference;%0A%0A/**%0A *%0A */%0Apublic class ExceptionalThenComposeTest extends CompletableFutureTestBase %7B%0A%0A%0A    @Test(expected = IntentionalException.class)%0A    public void exceptionCallingThenApplyAsSeenFromNextStage() throws Throwable %7B%0A        final AtomicReference%3CThrowable%3E thrownException = new AtomicReference%3C%3E(null);%0A        final CompletableFuture%3CObject%3E future = CompletableFuture.supplyAsync(delayedValueSupplier(1), executor)%0A                .thenCompose(i -%3E %7B%0A                    throw new IntentionalException();%0A                %7D)%0A                .whenComplete((v, t) -%3E %7B%0A                    if (t != null) %7B%0A                        thrownException.set(t);%0A                    %7D%0A                %7D);%0A        try %7B%0A            future.join();%0A        %7D catch (CompletionException ex) %7B%0A            throw (Optional.ofNullable(thrownException.get().getCause()).orElse(new RuntimeException(%22No thrown exception%22)));%0A        %7D%0A    %7D%0A%0A%7D%0A

Add exception propagation demo for thenCompose