public void testExceptionally_exceptionalCompletionActionFailed(){
  for (  boolean createIncomplete : new boolean[]{true,false}) {
    final AtomicInteger a=new AtomicInteger(0);
    final CFException ex1=new CFException();
    final CFException ex2=new CFException();
    final CompletableFuture<Integer> f=new CompletableFuture<>();
    if (!createIncomplete)     f.completeExceptionally(ex1);
    final CompletableFuture<Integer> g=f.exceptionally(null);
    if (createIncomplete)     f.completeExceptionally(ex1);
    checkCompletedWithWrappedException(g,ex2);
    checkCompletedExceptionally(f,ex1);
    assertEquals(1,a.get());
  }
}

public void testExceptionally_exceptionalCompletionActionFailed ( ) { for ( boolean createIncomplete : new boolean [ ] { true , false } ) { final AtomicInteger a = new AtomicInteger ( 0 ) ; final CFException ex1 = new CFException ( ) ; final CFException ex2 = new CFException ( ) ; final CompletableFuture < Integer > f = new CompletableFuture < > ( ) ; if ( ! createIncomplete ) f . completeExceptionally ( ex1 ) ; final CompletableFuture < Integer > g = f . exceptionally ( null ) ; if ( createIncomplete ) f . completeExceptionally ( ex1 ) ; checkCompletedWithWrappedException ( g , ex2 ) ; checkCompletedExceptionally ( f , ex1 ) ; assertEquals ( 1 , a . get ( ) ) ; } }
if an " exceptionally action " throws an exception , it completes exceptionally with that exception
