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.59 by jsr166, Tue Jun 3 03:54:14 2014 UTC vs.
Revision 1.60 by jsr166, Tue Jun 3 06:16:41 2014 UTC

# Line 320 | Line 320 | public class CompletableFutureTest exten
320          checkCompletedNormally(f, "test");
321      }
322  
323    // Choose non-commutative actions for better coverage
324
325    // A non-commutative function that handles and produces null values as well.
326    static Integer subtract(Integer x, Integer y) {
327        return (x == null && y == null) ? null :
328            ((x == null) ? 42 : x.intValue())
329            - ((y == null) ? 99 : y.intValue());
330    }
331
332    // A function that handles and produces null values as well.
333    static Integer inc(Integer x) {
334        return (x == null) ? null : x + 1;
335    }
336
323      static final class IntegerSupplier implements Supplier<Integer> {
324          final ExecutionMode m;
325          int invocationCount = 0;
# Line 348 | Line 334 | public class CompletableFutureTest exten
334              return value;
335          }
336      }
337 <        
337 >
338 >    // A function that handles and produces null values as well.
339 >    static Integer inc(Integer x) {
340 >        return (x == null) ? null : x + 1;
341 >    }
342 >
343      static final class IncAction implements Consumer<Integer> {
344          int invocationCount = 0;
345          Integer value;
# Line 368 | Line 359 | public class CompletableFutureTest exten
359              return value = inc(x);
360          }
361      }
362 +
363 +    // Choose non-commutative actions for better coverage
364 +    // A non-commutative function that handles and produces null values as well.
365 +    static Integer subtract(Integer x, Integer y) {
366 +        return (x == null && y == null) ? null :
367 +            ((x == null) ? 42 : x.intValue())
368 +            - ((y == null) ? 99 : y.intValue());
369 +    }
370 +
371      static final class SubtractAction implements BiConsumer<Integer, Integer> {
372          final ExecutionMode m;
373          int invocationCount = 0;
# Line 392 | Line 392 | public class CompletableFutureTest exten
392              return value = subtract(x, y);
393          }
394      }
395 +
396      static final class Noop implements Runnable {
397          final ExecutionMode m;
398          int invocationCount = 0;
# Line 505 | Line 506 | public class CompletableFutureTest exten
506  
507      /**
508       * Permits the testing of parallel code for the 3 different
509 <     * execution modes without repeating all the testing code.
509 >     * execution modes without copy/pasting all the test methods.
510       */
511      enum ExecutionMode {
512          DEFAULT {
513              public void checkExecutionMode() {
514 +                assertFalse(ThreadExecutor.startedCurrentThread());
515                  assertNull(ForkJoinTask.getPool());
516              }
517              public CompletableFuture<Void> runAsync(Runnable a) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines