351 |
|
f.completeExceptionally(new IndexOutOfBoundsException()); |
352 |
|
assertTrue(f.toString().contains("[Completed exceptionally]")); |
353 |
|
|
354 |
< |
f = new CompletableFuture<String>(); |
355 |
< |
f.cancel(true); |
356 |
< |
assertTrue(f.toString().contains("[Completed exceptionally]")); |
357 |
< |
|
358 |
< |
f = new CompletableFuture<String>(); |
359 |
< |
f.cancel(false); |
360 |
< |
assertTrue(f.toString().contains("[Completed exceptionally]")); |
354 |
> |
for (boolean mayInterruptIfRunning : new boolean[] { true, false }) { |
355 |
> |
f = new CompletableFuture<String>(); |
356 |
> |
f.cancel(mayInterruptIfRunning); |
357 |
> |
assertTrue(f.toString().contains("[Completed exceptionally]")); |
358 |
> |
} |
359 |
|
} |
360 |
|
|
361 |
|
/** |