--- jsr166/src/test/tck/CompletableFutureTest.java 2014/06/16 21:14:16 1.87 +++ jsr166/src/test/tck/CompletableFutureTest.java 2014/06/16 21:23:03 1.88 @@ -2922,7 +2922,7 @@ public class CompletableFutureTest exten * when all components complete normally */ public void testAllOf_normal() throws Exception { - for (int k = 1; k < 20; k++) { + for (int k = 1; k < 10; k++) { CompletableFuture[] fs = (CompletableFuture[]) new CompletableFuture[k]; for (int i = 0; i < k; i++) @@ -2939,7 +2939,7 @@ public class CompletableFutureTest exten } public void testAllOf_backwards() throws Exception { - for (int k = 1; k < 20; k++) { + for (int k = 1; k < 10; k++) { CompletableFuture[] fs = (CompletableFuture[]) new CompletableFuture[k]; for (int i = 0; i < k; i++) @@ -2955,6 +2955,30 @@ public class CompletableFutureTest exten } } + public void testAllOf_exceptional() throws Exception { + for (int k = 1; k < 10; k++) { + CompletableFuture[] fs + = (CompletableFuture[]) new CompletableFuture[k]; + CFException ex = new CFException(); + for (int i = 0; i < k; i++) + fs[i] = new CompletableFuture<>(); + CompletableFuture f = CompletableFuture.allOf(fs); + for (int i = 0; i < k; i++) { + checkIncomplete(f); + checkIncomplete(CompletableFuture.allOf(fs)); + if (i != k/2) { + fs[i].complete(i); + checkCompletedNormally(fs[i], i); + } else { + fs[i].completeExceptionally(ex); + checkCompletedExceptionally(fs[i], ex); + } + } + checkCompletedWithWrappedException(f, ex); + checkCompletedWithWrappedException(CompletableFuture.allOf(fs), ex); + } + } + /** * anyOf(no component futures) returns an incomplete future */