3852 |
|
final CompletableFuture<Integer> v42 = CompletableFuture.completedFuture(42); |
3853 |
|
final CompletableFuture<Integer> incomplete = new CompletableFuture<>(); |
3854 |
|
|
3855 |
+ |
final Runnable noopRunnable = new Noop(m); |
3856 |
+ |
final Consumer<Integer> noopConsumer = new NoopConsumer(m); |
3857 |
+ |
final Function<Integer, Integer> incFunction = new IncFunction(m); |
3858 |
+ |
|
3859 |
|
List<Function<CompletableFuture<Integer>, CompletableFuture<?>>> funs |
3860 |
|
= new ArrayList<>(); |
3861 |
|
|
3862 |
< |
funs.add((y) -> m.thenRun(y, new Noop(m))); |
3863 |
< |
funs.add((y) -> m.thenAccept(y, new NoopConsumer(m))); |
3864 |
< |
funs.add((y) -> m.thenApply(y, new IncFunction(m))); |
3865 |
< |
|
3866 |
< |
funs.add((y) -> m.runAfterEither(y, incomplete, new Noop(m))); |
3867 |
< |
funs.add((y) -> m.acceptEither(y, incomplete, new NoopConsumer(m))); |
3868 |
< |
funs.add((y) -> m.applyToEither(y, incomplete, new IncFunction(m))); |
3862 |
> |
funs.add((y) -> m.thenRun(y, noopRunnable)); |
3863 |
> |
funs.add((y) -> m.thenAccept(y, noopConsumer)); |
3864 |
> |
funs.add((y) -> m.thenApply(y, incFunction)); |
3865 |
> |
|
3866 |
> |
funs.add((y) -> m.runAfterEither(y, incomplete, noopRunnable)); |
3867 |
> |
funs.add((y) -> m.acceptEither(y, incomplete, noopConsumer)); |
3868 |
> |
funs.add((y) -> m.applyToEither(y, incomplete, incFunction)); |
3869 |
|
|
3870 |
< |
funs.add((y) -> m.runAfterBoth(y, v42, new Noop(m))); |
3871 |
< |
funs.add((y) -> m.runAfterBoth(v42, y, new Noop(m))); |
3870 |
> |
funs.add((y) -> m.runAfterBoth(y, v42, noopRunnable)); |
3871 |
> |
funs.add((y) -> m.runAfterBoth(v42, y, noopRunnable)); |
3872 |
|
funs.add((y) -> m.thenAcceptBoth(y, v42, new SubtractAction(m))); |
3873 |
|
funs.add((y) -> m.thenAcceptBoth(v42, y, new SubtractAction(m))); |
3874 |
|
funs.add((y) -> m.thenCombine(y, v42, new SubtractFunction(m))); |
3878 |
|
|
3879 |
|
funs.add((y) -> m.thenCompose(y, new CompletableFutureInc(m))); |
3880 |
|
|
3881 |
< |
funs.add((y) -> CompletableFuture.allOf(new CompletableFuture<?>[] {y})); |
3882 |
< |
funs.add((y) -> CompletableFuture.allOf(new CompletableFuture<?>[] {y, v42})); |
3883 |
< |
funs.add((y) -> CompletableFuture.allOf(new CompletableFuture<?>[] {v42, y})); |
3884 |
< |
funs.add((y) -> CompletableFuture.anyOf(new CompletableFuture<?>[] {y})); |
3885 |
< |
funs.add((y) -> CompletableFuture.anyOf(new CompletableFuture<?>[] {y, incomplete})); |
3886 |
< |
funs.add((y) -> CompletableFuture.anyOf(new CompletableFuture<?>[] {incomplete, y})); |
3881 |
> |
funs.add((y) -> CompletableFuture.allOf(y)); |
3882 |
> |
funs.add((y) -> CompletableFuture.allOf(y, v42)); |
3883 |
> |
funs.add((y) -> CompletableFuture.allOf(v42, y)); |
3884 |
> |
funs.add((y) -> CompletableFuture.anyOf(y)); |
3885 |
> |
funs.add((y) -> CompletableFuture.anyOf(y, incomplete)); |
3886 |
> |
funs.add((y) -> CompletableFuture.anyOf(incomplete, y)); |
3887 |
|
|
3888 |
|
for (Function<CompletableFuture<Integer>, CompletableFuture<?>> |
3889 |
|
fun : funs) { |
3890 |
|
CompletableFuture<Integer> f = new CompletableFuture<>(); |
3891 |
|
f.completeExceptionally(ex); |
3892 |
< |
CompletableFuture<Integer> src = m.thenApply(f, new IncFunction(m)); |
3892 |
> |
CompletableFuture<Integer> src = m.thenApply(f, incFunction); |
3893 |
|
checkCompletedWithWrappedException(src, ex); |
3894 |
|
CompletableFuture<?> dep = fun.apply(src); |
3895 |
|
checkCompletedWithWrappedException(dep, ex); |
3899 |
|
for (Function<CompletableFuture<Integer>, CompletableFuture<?>> |
3900 |
|
fun : funs) { |
3901 |
|
CompletableFuture<Integer> f = new CompletableFuture<>(); |
3902 |
< |
CompletableFuture<Integer> src = m.thenApply(f, new IncFunction(m)); |
3902 |
> |
CompletableFuture<Integer> src = m.thenApply(f, incFunction); |
3903 |
|
CompletableFuture<?> dep = fun.apply(src); |
3904 |
|
f.completeExceptionally(ex); |
3905 |
|
checkCompletedWithWrappedException(src, ex); |
3913 |
|
CompletableFuture<Integer> f = new CompletableFuture<>(); |
3914 |
|
f.cancel(mayInterruptIfRunning); |
3915 |
|
checkCancelled(f); |
3916 |
< |
CompletableFuture<Integer> src = m.thenApply(f, new IncFunction(m)); |
3916 |
> |
CompletableFuture<Integer> src = m.thenApply(f, incFunction); |
3917 |
|
checkCompletedWithWrappedCancellationException(src); |
3918 |
|
CompletableFuture<?> dep = fun.apply(src); |
3919 |
|
checkCompletedWithWrappedCancellationException(dep); |
3924 |
|
for (Function<CompletableFuture<Integer>, CompletableFuture<?>> |
3925 |
|
fun : funs) { |
3926 |
|
CompletableFuture<Integer> f = new CompletableFuture<>(); |
3927 |
< |
CompletableFuture<Integer> src = m.thenApply(f, new IncFunction(m)); |
3927 |
> |
CompletableFuture<Integer> src = m.thenApply(f, incFunction); |
3928 |
|
CompletableFuture<?> dep = fun.apply(src); |
3929 |
|
f.cancel(mayInterruptIfRunning); |
3930 |
|
checkCancelled(f); |