4780 |
|
} |
4781 |
|
|
4782 |
|
/** |
4783 |
+ |
* default-implemented exceptionallyAsync action is not invoked when |
4784 |
+ |
* source completes normally, and source result is propagated |
4785 |
+ |
*/ |
4786 |
+ |
public void testDefaultExceptionallyAsync_normalCompletion() { |
4787 |
+ |
for (boolean createIncomplete : new boolean[] { true, false }) |
4788 |
+ |
for (Integer v1 : new Integer[] { 1, null }) |
4789 |
+ |
{ |
4790 |
+ |
final CompletableFuture<Integer> f = new CompletableFuture<>(); |
4791 |
+ |
final DelegatedCompletionStage<Integer> d = |
4792 |
+ |
new DelegatedCompletionStage<Integer>(f); |
4793 |
+ |
if (!createIncomplete) assertTrue(f.complete(v1)); |
4794 |
+ |
final CompletionStage<Integer> g = d.exceptionallyAsync |
4795 |
+ |
((Throwable t) -> { |
4796 |
+ |
threadFail("should not be called"); |
4797 |
+ |
return null; // unreached |
4798 |
+ |
}); |
4799 |
+ |
if (createIncomplete) assertTrue(f.complete(v1)); |
4800 |
+ |
|
4801 |
+ |
checkCompletedNormally(g.toCompletableFuture(), v1); |
4802 |
+ |
}} |
4803 |
+ |
|
4804 |
+ |
/** |
4805 |
|
* default-implemented exceptionallyAsync action completes with |
4806 |
|
* function value on source exception |
4807 |
|
*/ |