ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CompletableFutureTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CompletableFutureTest.java (file contents):
Revision 1.87 by jsr166, Mon Jun 16 21:14:16 2014 UTC vs.
Revision 1.88 by jsr166, Mon Jun 16 21:23:03 2014 UTC

# Line 2922 | Line 2922 | public class CompletableFutureTest exten
2922       * when all components complete normally
2923       */
2924      public void testAllOf_normal() throws Exception {
2925 <        for (int k = 1; k < 20; k++) {
2925 >        for (int k = 1; k < 10; k++) {
2926              CompletableFuture<Integer>[] fs
2927                  = (CompletableFuture<Integer>[]) new CompletableFuture[k];
2928              for (int i = 0; i < k; i++)
# Line 2939 | Line 2939 | public class CompletableFutureTest exten
2939      }
2940  
2941      public void testAllOf_backwards() throws Exception {
2942 <        for (int k = 1; k < 20; k++) {
2942 >        for (int k = 1; k < 10; k++) {
2943              CompletableFuture<Integer>[] fs
2944                  = (CompletableFuture<Integer>[]) new CompletableFuture[k];
2945              for (int i = 0; i < k; i++)
# Line 2955 | Line 2955 | public class CompletableFutureTest exten
2955          }
2956      }
2957  
2958 +    public void testAllOf_exceptional() throws Exception {
2959 +        for (int k = 1; k < 10; k++) {
2960 +            CompletableFuture<Integer>[] fs
2961 +                = (CompletableFuture<Integer>[]) new CompletableFuture[k];
2962 +            CFException ex = new CFException();
2963 +            for (int i = 0; i < k; i++)
2964 +                fs[i] = new CompletableFuture<>();
2965 +            CompletableFuture<Void> f = CompletableFuture.allOf(fs);
2966 +            for (int i = 0; i < k; i++) {
2967 +                checkIncomplete(f);
2968 +                checkIncomplete(CompletableFuture.allOf(fs));
2969 +                if (i != k/2) {
2970 +                    fs[i].complete(i);
2971 +                    checkCompletedNormally(fs[i], i);
2972 +                } else {
2973 +                    fs[i].completeExceptionally(ex);
2974 +                    checkCompletedExceptionally(fs[i], ex);
2975 +                }
2976 +            }
2977 +            checkCompletedWithWrappedException(f, ex);
2978 +            checkCompletedWithWrappedException(CompletableFuture.allOf(fs), ex);
2979 +        }
2980 +    }
2981 +
2982      /**
2983       * anyOf(no component futures) returns an incomplete future
2984       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines