--- jsr166/src/test/tck/CompletableFutureTest.java 2015/09/04 20:44:50 1.115 +++ jsr166/src/test/tck/CompletableFutureTest.java 2015/09/06 16:31:46 1.119 @@ -3349,6 +3349,9 @@ public class CompletableFutureTest exten () -> CompletableFuture.delayedExecutor(1L, SECONDS, null), () -> CompletableFuture.delayedExecutor(1L, null, new ThreadExecutor()), () -> CompletableFuture.delayedExecutor(1L, null), + + () -> f.orTimeout(1L, null), + () -> f.completeOnTimeout(42, 1L, null), }; assertThrows(NullPointerException.class, throwingActions); @@ -3369,11 +3372,19 @@ public class CompletableFutureTest exten * newIncompleteFuture returns an incomplete CompletableFuture */ public void testNewIncompleteFuture() { + for (Integer v1 : new Integer[] { 1, null }) + { CompletableFuture f = new CompletableFuture<>(); CompletableFuture g = f.newIncompleteFuture(); checkIncomplete(f); checkIncomplete(g); - } + f.complete(v1); + checkCompletedNormally(f, v1); + checkIncomplete(g); + g.complete(v1); + checkCompletedNormally(g, v1); + assertSame(g.getClass(), CompletableFuture.class); + }} /** * completedStage returns a completed CompletionStage @@ -3408,13 +3419,13 @@ public class CompletableFutureTest exten public void testFailedFuture() { CFException ex = new CFException(); CompletableFuture f = CompletableFuture.failedFuture(ex); - checkCompletedExceptionallyWithRootCause(f, ex); + checkCompletedExceptionally(f, ex); } /** * failedFuture(null) throws NPE */ - public void testFailedFuture2() { + public void testFailedFuture_null() { try { CompletableFuture f = CompletableFuture.failedFuture(null); shouldThrow(); @@ -3496,7 +3507,7 @@ public class CompletableFutureTest exten AtomicReference r = new AtomicReference(); f.whenComplete((v, e) -> {if (e != null) r.set(e); else x.set(v);}); assertEquals(x.get(), 0); - assertEquals(r.get().getCause(), ex); + assertEquals(r.get(), ex); } /**