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.218 by jsr166, Sat Nov 24 18:24:14 2018 UTC vs.
Revision 1.221 by jsr166, Fri Feb 22 19:27:47 2019 UTC

# Line 926 | Line 926 | public class CompletableFutureTest exten
926          for (boolean createIncomplete : new boolean[] { true, false })
927          for (Integer v1 : new Integer[] { 1, null })
928      {
929 +        final AtomicInteger ran = new AtomicInteger(0);
930          final CompletableFuture<Integer> f = new CompletableFuture<>();
931          if (!createIncomplete) assertTrue(f.complete(v1));
932          final CompletableFuture<Integer> g = m.exceptionally
933              (f, (Throwable t) -> {
934 <                threadFail("should not be called");
935 <                return null;            // unreached
934 >                ran.getAndIncrement();
935 >                throw new AssertionError("should not be called");
936              });
937          if (createIncomplete) assertTrue(f.complete(v1));
938  
939          checkCompletedNormally(g, v1);
940          checkCompletedNormally(f, v1);
941 +        assertEquals(0, ran.get());
942      }}
943  
944      /**
# Line 3436 | Line 3438 | public class CompletableFutureTest exten
3438          CompletableFuture<Integer> nullFuture = (CompletableFuture<Integer>)null;
3439          ThreadExecutor exec = new ThreadExecutor();
3440  
3441 <        Runnable[] throwingActions = {
3441 >        assertThrows(
3442 >            NullPointerException.class,
3443 >
3444              () -> CompletableFuture.supplyAsync(null),
3445              () -> CompletableFuture.supplyAsync(null, exec),
3446              () -> CompletableFuture.supplyAsync(new IntegerSupplier(ExecutionMode.SYNC, 42), null),
# Line 3539 | Line 3543 | public class CompletableFutureTest exten
3543              () -> f.completeOnTimeout(42, 1L, null),
3544  
3545              () -> CompletableFuture.failedFuture(null),
3546 <            () -> CompletableFuture.failedStage(null),
3543 <        };
3546 >            () -> CompletableFuture.failedStage(null));
3547  
3545        assertThrows(NullPointerException.class, throwingActions);
3548          assertEquals(0, exec.count.get());
3549      }
3550  
# Line 4829 | Line 4831 | public class CompletableFutureTest exten
4831          for (boolean createIncomplete : new boolean[] { true, false })
4832          for (Integer v1 : new Integer[] { 1, null })
4833      {
4834 +        final AtomicInteger ran = new AtomicInteger(0);
4835          final CompletableFuture<Integer> f = new CompletableFuture<>();
4836          final DelegatedCompletionStage<Integer> d =
4837              new DelegatedCompletionStage<Integer>(f);
4838          if (!createIncomplete) assertTrue(f.complete(v1));
4839          final CompletionStage<Integer> g = d.exceptionallyAsync
4840              ((Throwable t) -> {
4841 <                threadFail("should not be called");
4842 <                return null;            // unreached
4841 >                ran.getAndIncrement();
4842 >                throw new AssertionError("should not be called");
4843              });
4844          if (createIncomplete) assertTrue(f.complete(v1));
4845  
4846          checkCompletedNormally(g.toCompletableFuture(), v1);
4847 +        checkCompletedNormally(f, v1);
4848 +        assertEquals(0, ran.get());
4849      }}
4850  
4851      /**
# Line 4866 | Line 4871 | public class CompletableFutureTest exten
4871          if (createIncomplete) f.completeExceptionally(ex);
4872  
4873          checkCompletedNormally(g.toCompletableFuture(), v1);
4874 +        checkCompletedExceptionally(f, ex);
4875          assertEquals(1, ran.get());
4876      }}
4877  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines