--- jsr166/src/test/tck/CompletableFutureTest.java 2015/09/03 16:30:05 1.105 +++ jsr166/src/test/tck/CompletableFutureTest.java 2015/09/04 19:46:22 1.112 @@ -3333,6 +3333,7 @@ public class CompletableFutureTest exten () -> f.exceptionally(null), () -> f.handle(null), + () -> CompletableFuture.allOf((CompletableFuture)null), () -> CompletableFuture.allOf((CompletableFuture[])null), () -> CompletableFuture.allOf(f, null), @@ -3384,14 +3385,16 @@ public class CompletableFutureTest exten /** * defaultExecutor by default returns the commonPool if - * it supports at least one thread. + * it supports more than one thread. */ public void testDefaultExecutor() { CompletableFuture f = new CompletableFuture<>(); Executor e = f.defaultExecutor(); - Executor c = ForkJoinPool.commonPool(); + Executor c = ForkJoinPool.commonPool(); if (ForkJoinPool.getCommonPoolParallelism() > 1) assertSame(e, c); + else + assertNotSame(e, c); } /** @@ -3479,7 +3482,7 @@ public class CompletableFutureTest exten } /** - * failedStage returns a Completionstage completed + * failedStage returns a CompletionStage completed * exceptionally with the given Exception */ public void testFailedStage() { @@ -3542,41 +3545,41 @@ public class CompletableFutureTest exten } /** - * orTimeout completes with TimeoutException if not complete + * orTimeout completes with TimeoutException if not complete */ public void testOrTimeout() { CompletableFuture f = new CompletableFuture<>(); - f.orTimeout(SHORT_DELAY_MS, TimeUnit.MILLISECONDS); + f.orTimeout(SHORT_DELAY_MS, MILLISECONDS); checkCompletedExceptionallyWithTimeout(f); } /** - * orTimeout completes normally if completed before timeout + * orTimeout completes normally if completed before timeout */ public void testOrTimeout2() { CompletableFuture f = new CompletableFuture<>(); f.complete(1); - f.orTimeout(SHORT_DELAY_MS, TimeUnit.MILLISECONDS); + f.orTimeout(SHORT_DELAY_MS, MILLISECONDS); checkCompletedNormally(f, 1); } /** - * completeOnTimeout completes with given value if not complete + * completeOnTimeout completes with given value if not complete */ public void testCompleteOnTimeout() { CompletableFuture f = new CompletableFuture<>(); - f.completeOnTimeout(-1, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); + f.completeOnTimeout(-1, SHORT_DELAY_MS, MILLISECONDS); f.join(); checkCompletedNormally(f, -1); } /** - * completeOnTimeout has no effect if completed within timeout + * completeOnTimeout has no effect if completed within timeout */ public void testCompleteOnTimeout2() { CompletableFuture f = new CompletableFuture<>(); f.complete(1); - f.completeOnTimeout(-1, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); + f.completeOnTimeout(-1, SHORT_DELAY_MS, MILLISECONDS); checkCompletedNormally(f, 1); }