ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CompletableFutureTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CompletableFutureTest.java (file contents):
Revision 1.205 by jsr166, Sun Sep 23 00:55:03 2018 UTC vs.
Revision 1.206 by jsr166, Sun Sep 23 02:04:03 2018 UTC

# Line 4780 | Line 4780 | public class CompletableFutureTest exten
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       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines