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++) |
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++) |
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 |
|
*/ |