--- jsr166/src/test/tck/CompletableFutureTest.java 2014/06/03 03:54:14 1.59 +++ jsr166/src/test/tck/CompletableFutureTest.java 2014/06/03 06:16:41 1.60 @@ -320,20 +320,6 @@ public class CompletableFutureTest exten checkCompletedNormally(f, "test"); } - // Choose non-commutative actions for better coverage - - // A non-commutative function that handles and produces null values as well. - static Integer subtract(Integer x, Integer y) { - return (x == null && y == null) ? null : - ((x == null) ? 42 : x.intValue()) - - ((y == null) ? 99 : y.intValue()); - } - - // A function that handles and produces null values as well. - static Integer inc(Integer x) { - return (x == null) ? null : x + 1; - } - static final class IntegerSupplier implements Supplier { final ExecutionMode m; int invocationCount = 0; @@ -348,7 +334,12 @@ public class CompletableFutureTest exten return value; } } - + + // A function that handles and produces null values as well. + static Integer inc(Integer x) { + return (x == null) ? null : x + 1; + } + static final class IncAction implements Consumer { int invocationCount = 0; Integer value; @@ -368,6 +359,15 @@ public class CompletableFutureTest exten return value = inc(x); } } + + // Choose non-commutative actions for better coverage + // A non-commutative function that handles and produces null values as well. + static Integer subtract(Integer x, Integer y) { + return (x == null && y == null) ? null : + ((x == null) ? 42 : x.intValue()) + - ((y == null) ? 99 : y.intValue()); + } + static final class SubtractAction implements BiConsumer { final ExecutionMode m; int invocationCount = 0; @@ -392,6 +392,7 @@ public class CompletableFutureTest exten return value = subtract(x, y); } } + static final class Noop implements Runnable { final ExecutionMode m; int invocationCount = 0; @@ -505,11 +506,12 @@ public class CompletableFutureTest exten /** * Permits the testing of parallel code for the 3 different - * execution modes without repeating all the testing code. + * execution modes without copy/pasting all the test methods. */ enum ExecutionMode { DEFAULT { public void checkExecutionMode() { + assertFalse(ThreadExecutor.startedCurrentThread()); assertNull(ForkJoinTask.getPool()); } public CompletableFuture runAsync(Runnable a) {