3009 |
|
public void testAnyOf_exceptional() throws Exception { |
3010 |
|
for (int k = 0; k < 10; k++) { |
3011 |
|
CompletableFuture[] fs = new CompletableFuture[k]; |
3012 |
< |
for (int i = 0; i < k; i++) |
3012 |
> |
CFException[] exs = new CFException[k]; |
3013 |
> |
for (int i = 0; i < k; i++) { |
3014 |
|
fs[i] = new CompletableFuture<>(); |
3015 |
+ |
exs[i] = new CFException(); |
3016 |
+ |
} |
3017 |
|
CompletableFuture<Object> f = CompletableFuture.anyOf(fs); |
3018 |
|
checkIncomplete(f); |
3019 |
|
for (int i = 0; i < k; i++) { |
3020 |
< |
fs[i].completeExceptionally(new CFException()); |
3021 |
< |
checkCompletedWithWrappedCFException(f); |
3020 |
> |
fs[i].completeExceptionally(exs[i]); |
3021 |
> |
checkCompletedWithWrappedException(f, exs[0]); |
3022 |
> |
checkCompletedWithWrappedCFException(CompletableFuture.anyOf(fs)); |
3023 |
> |
} |
3024 |
> |
} |
3025 |
> |
} |
3026 |
> |
|
3027 |
> |
public void testAnyOf_exceptional_backwards() throws Exception { |
3028 |
> |
for (int k = 0; k < 10; k++) { |
3029 |
> |
CompletableFuture[] fs = new CompletableFuture[k]; |
3030 |
> |
CFException[] exs = new CFException[k]; |
3031 |
> |
for (int i = 0; i < k; i++) { |
3032 |
> |
fs[i] = new CompletableFuture<>(); |
3033 |
> |
exs[i] = new CFException(); |
3034 |
> |
} |
3035 |
> |
CompletableFuture<Object> f = CompletableFuture.anyOf(fs); |
3036 |
> |
checkIncomplete(f); |
3037 |
> |
for (int i = k - 1; i >= 0; i--) { |
3038 |
> |
fs[i].completeExceptionally(exs[i]); |
3039 |
> |
checkCompletedWithWrappedException(f, exs[k - 1]); |
3040 |
|
checkCompletedWithWrappedCFException(CompletableFuture.anyOf(fs)); |
3041 |
|
} |
3042 |
|
} |