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.112 by jsr166, Fri Sep 4 19:46:22 2015 UTC vs.
Revision 1.116 by jsr166, Fri Sep 4 20:57:10 2015 UTC

# Line 3345 | Line 3345 | public class CompletableFutureTest exten
3345              () -> CompletableFuture.anyOf(null, f),
3346  
3347              () -> f.obtrudeException(null),
3348 +
3349 +            () -> CompletableFuture.delayedExecutor(1L, SECONDS, null),
3350 +            () -> CompletableFuture.delayedExecutor(1L, null, new ThreadExecutor()),
3351 +            () -> CompletableFuture.delayedExecutor(1L, null),
3352 +
3353 +            () -> f.orTimeout(1L, null),
3354 +            () -> f.completeOnTimeout(42, 1L, null),
3355          };
3356  
3357          assertThrows(NullPointerException.class, throwingActions);
# Line 3586 | Line 3593 | public class CompletableFutureTest exten
3593      /**
3594       * delayedExecutor returns an executor that delays submission
3595       */
3596 <    public void testDelayedExecutor() {
3596 >    public void testDelayedExecutor() throws Exception {
3597          long timeoutMillis = SMALL_DELAY_MS;
3598          Executor d = CompletableFuture.delayedExecutor(timeoutMillis,
3599                                                         MILLISECONDS);
3600          long startTime = System.nanoTime();
3601          CompletableFuture<Integer> f = CompletableFuture.supplyAsync(() -> 1, d);
3602          assertNull(f.getNow(null));
3603 <        try {
3597 <            f.get(LONG_DELAY_MS, MILLISECONDS);
3598 <        } catch (Throwable fail) { threadUnexpectedException(fail); }
3603 >        assertEquals(1, (int) f.get(LONG_DELAY_MS, MILLISECONDS));
3604          assertTrue(millisElapsedSince(startTime) > timeoutMillis/2);
3605          checkCompletedNormally(f, 1);
3606      }
# Line 3604 | Line 3609 | public class CompletableFutureTest exten
3609       * delayedExecutor for a given executor returns an executor that
3610       * delays submission
3611       */
3612 <    public void testDelayedExecutor2() {
3612 >    public void testDelayedExecutor2() throws Exception {
3613          long timeoutMillis = SMALL_DELAY_MS;
3614          Executor d = CompletableFuture.delayedExecutor(timeoutMillis,
3615                                                         MILLISECONDS,
# Line 3612 | Line 3617 | public class CompletableFutureTest exten
3617          long startTime = System.nanoTime();
3618          CompletableFuture<Integer> f = CompletableFuture.supplyAsync(() -> 1, d);
3619          assertNull(f.getNow(null));
3620 <        try {
3616 <            f.get(LONG_DELAY_MS, MILLISECONDS);
3617 <        } catch (Throwable fail) { threadUnexpectedException(fail); }
3620 >        assertEquals(1, (int) f.get(LONG_DELAY_MS, MILLISECONDS));
3621          assertTrue(millisElapsedSince(startTime) > timeoutMillis/2);
3622          checkCompletedNormally(f, 1);
3623      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines