--- jsr166/src/test/tck/CompletableFutureTest.java 2014/06/02 23:10:08 1.58 +++ jsr166/src/test/tck/CompletableFutureTest.java 2014/06/03 03:54:14 1.59 @@ -2614,7 +2614,8 @@ public class CompletableFutureTest exten */ public void testAllOf_normal() throws Exception { for (int k = 1; k < 20; ++k) { - CompletableFuture[] fs = (CompletableFuture[]) new CompletableFuture[k]; + CompletableFuture[] fs + = (CompletableFuture[]) new CompletableFuture[k]; for (int i = 0; i < k; ++i) fs[i] = new CompletableFuture<>(); CompletableFuture f = CompletableFuture.allOf(fs); @@ -2622,6 +2623,23 @@ public class CompletableFutureTest exten checkIncomplete(f); checkIncomplete(CompletableFuture.allOf(fs)); fs[i].complete(one); + } + checkCompletedNormally(f, null); + checkCompletedNormally(CompletableFuture.allOf(fs), null); + } + } + + public void testAllOf_backwards() throws Exception { + for (int k = 1; k < 20; ++k) { + CompletableFuture[] fs + = (CompletableFuture[]) new CompletableFuture[k]; + for (int i = 0; i < k; ++i) + fs[i] = new CompletableFuture<>(); + CompletableFuture f = CompletableFuture.allOf(fs); + for (int i = k - 1; i >= 0; i--) { + checkIncomplete(f); + checkIncomplete(CompletableFuture.allOf(fs)); + fs[i].complete(one); } checkCompletedNormally(f, null); checkCompletedNormally(CompletableFuture.allOf(fs), null);