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.70 by jsr166, Fri Jun 6 19:48:38 2014 UTC vs.
Revision 1.74 by jsr166, Fri Jun 6 21:19:22 2014 UTC

# Line 105 | Line 105 | public class CompletableFutureTest exten
105          assertTrue(f.toString().contains("[Completed exceptionally]"));
106      }
107  
108 <    void checkCompletedWithWrappedCFException(CompletableFuture<?> f,
109 <                                              CFException ex) {
108 >    <U> void checkCompletedExceptionallyWithRootCause(CompletableFuture<U> f,
109 >                                                      Throwable ex) {
110          try {
111              f.get(LONG_DELAY_MS, MILLISECONDS);
112              shouldThrow();
# Line 131 | Line 131 | public class CompletableFutureTest exten
131          } catch (ExecutionException success) {
132              assertSame(ex, success.getCause());
133          } catch (Throwable fail) { threadUnexpectedException(fail); }
134 +
135          assertTrue(f.isDone());
136          assertFalse(f.isCancelled());
137          assertTrue(f.toString().contains("[Completed exceptionally]"));
138      }
139  
140 +    <U> void checkCompletedWithWrappedException(CompletableFuture<U> f,
141 +                                                Throwable ex) {
142 +        checkCompletedExceptionallyWithRootCause(f, ex);
143 +        try {
144 +            CompletableFuture<Throwable> spy = f.handle
145 +                ((U u, Throwable t) -> t);
146 +            assertTrue(spy.join() instanceof CompletionException);
147 +            assertSame(ex, spy.join().getCause());
148 +        } catch (Throwable fail) { threadUnexpectedException(fail); }
149 +    }
150 +
151 +    <U> void checkCompletedExceptionally(CompletableFuture<U> f, Throwable ex) {
152 +        checkCompletedExceptionallyWithRootCause(f, ex);
153 +        try {
154 +            CompletableFuture<Throwable> spy = f.handle
155 +                ((U u, Throwable t) -> t);
156 +            assertSame(ex, spy.join());
157 +        } catch (Throwable fail) { threadUnexpectedException(fail); }
158 +    }
159 +
160      void checkCancelled(CompletableFuture<?> f) {
161          try {
162              f.get(LONG_DELAY_MS, MILLISECONDS);
# Line 218 | Line 239 | public class CompletableFutureTest exten
239       */
240      public void testCompleteExceptionally() {
241          CompletableFuture<Integer> f = new CompletableFuture<>();
242 +        CFException ex = new CFException();
243          checkIncomplete(f);
244 <        f.completeExceptionally(new CFException());
245 <        checkCompletedWithWrappedCFException(f);
244 >        f.completeExceptionally(ex);
245 >        checkCompletedExceptionally(f, ex);
246      }
247  
248      /**
# Line 261 | Line 283 | public class CompletableFutureTest exten
283       * obtrudeException forces completion with given exception
284       */
285      public void testObtrudeException() {
286 <        CompletableFuture<Integer> f = new CompletableFuture<>();
287 <        checkIncomplete(f);
288 <        f.complete(one);
289 <        checkCompletedNormally(f, one);
290 <        f.obtrudeException(new CFException());
269 <        checkCompletedWithWrappedCFException(f);
286 >        for (Integer v1 : new Integer[] { 1, null })
287 >    {
288 >        CFException ex;
289 >        CompletableFuture<Integer> f;
290 >
291          f = new CompletableFuture<>();
292 <        f.obtrudeException(new CFException());
293 <        checkCompletedWithWrappedCFException(f);
292 >        f.complete(v1);
293 >        for (int i = 0; i < 2; i++) {
294 >            f.obtrudeException(ex = new CFException());
295 >            checkCompletedExceptionally(f, ex);
296 >        }
297 >
298 >        f = new CompletableFuture<>();
299 >        for (int i = 0; i < 2; i++) {
300 >            f.obtrudeException(ex = new CFException());
301 >            checkCompletedExceptionally(f, ex);
302 >        }
303 >
304          f = new CompletableFuture<>();
305 +        f.completeExceptionally(ex = new CFException());
306 +        f.obtrudeValue(v1);
307 +        checkCompletedNormally(f, v1);
308 +        f.obtrudeException(ex = new CFException());
309 +        checkCompletedExceptionally(f, ex);
310          f.completeExceptionally(new CFException());
311 <        f.obtrudeValue(four);
312 <        checkCompletedNormally(f, four);
313 <        f.obtrudeException(new CFException());
314 <        checkCompletedWithWrappedCFException(f);
279 <    }
311 >        checkCompletedExceptionally(f, ex);
312 >        f.complete(v1);
313 >        checkCompletedExceptionally(f, ex);
314 >    }}
315  
316      /**
317       * getNumberOfDependents returns number of dependent tasks
# Line 310 | Line 345 | public class CompletableFutureTest exten
345          f = new CompletableFuture<String>();
346          f.completeExceptionally(new IndexOutOfBoundsException());
347          assertTrue(f.toString().contains("[Completed exceptionally]"));
348 +
349 +        f = new CompletableFuture<String>();
350 +        f.cancel(true);
351 +        assertTrue(f.toString().contains("[Completed exceptionally]"));
352 +
353 +        f = new CompletableFuture<String>();
354 +        f.cancel(false);
355 +        assertTrue(f.toString().contains("[Completed exceptionally]"));
356      }
357  
358      /**
# Line 852 | Line 895 | public class CompletableFutureTest exten
895              });
896          if (createIncomplete) f.completeExceptionally(ex1);
897  
898 <        checkCompletedWithWrappedCFException(g, ex2);
898 >        checkCompletedWithWrappedException(g, ex2);
899          assertEquals(1, a.get());
900      }}
901  
# Line 909 | Line 952 | public class CompletableFutureTest exten
952          if (createIncomplete) f.completeExceptionally(ex);
953  
954          checkCompletedNormally(g, v1);
955 <        checkCompletedWithWrappedCFException(f, ex);
955 >        checkCompletedExceptionally(f, ex);
956          assertEquals(1, a.get());
957      }}
958  
# Line 965 | Line 1008 | public class CompletableFutureTest exten
1008              });
1009          if (createIncomplete) f.completeExceptionally(ex1);
1010  
1011 <        checkCompletedWithWrappedCFException(g, ex2);
1012 <        checkCompletedWithWrappedCFException(f, ex1);
1011 >        checkCompletedWithWrappedException(g, ex2);
1012 >        checkCompletedExceptionally(f, ex1);
1013          assertEquals(1, a.get());
1014      }}
1015  
# Line 990 | Line 1033 | public class CompletableFutureTest exten
1033              });
1034          if (createIncomplete) f.complete(v1);
1035  
1036 <        checkCompletedWithWrappedCFException(g, ex);
1036 >        checkCompletedWithWrappedException(g, ex);
1037          checkCompletedNormally(f, v1);
1038          assertEquals(1, a.get());
1039      }}
# Line 1104 | Line 1147 | public class CompletableFutureTest exten
1147              f.completeExceptionally(ex);
1148          }
1149  
1150 <        checkCompletedWithWrappedCFException(g, ex);
1151 <        checkCompletedWithWrappedCFException(f, ex);
1150 >        checkCompletedWithWrappedException(g, ex);
1151 >        checkCompletedExceptionally(f, ex);
1152          r.assertNotInvoked();
1153      }}
1154  
# Line 1192 | Line 1235 | public class CompletableFutureTest exten
1235              f.completeExceptionally(ex);
1236          }
1237  
1238 <        checkCompletedWithWrappedCFException(g, ex);
1239 <        checkCompletedWithWrappedCFException(f, ex);
1238 >        checkCompletedWithWrappedException(g, ex);
1239 >        checkCompletedExceptionally(f, ex);
1240          r.assertNotInvoked();
1241      }}
1242  
# Line 1280 | Line 1323 | public class CompletableFutureTest exten
1323              f.completeExceptionally(ex);
1324          }
1325  
1326 <        checkCompletedWithWrappedCFException(g, ex);
1327 <        checkCompletedWithWrappedCFException(f, ex);
1326 >        checkCompletedWithWrappedException(g, ex);
1327 >        checkCompletedExceptionally(f, ex);
1328          r.assertNotInvoked();
1329      }}
1330  
# Line 1383 | Line 1426 | public class CompletableFutureTest exten
1426              (!fFirst ? f : g).completeExceptionally(ex);
1427          }
1428  
1429 <        checkCompletedWithWrappedCFException(h, ex);
1429 >        checkCompletedWithWrappedException(h, ex);
1430          r.assertNotInvoked();
1431          checkCompletedNormally(fFirst ? f : g, v1);
1432 <        checkCompletedWithWrappedCFException(!fFirst ? f : g, ex);
1432 >        checkCompletedExceptionally(!fFirst ? f : g, ex);
1433      }}
1434  
1435      /**
# Line 1500 | Line 1543 | public class CompletableFutureTest exten
1543              (!fFirst ? f : g).completeExceptionally(ex);
1544          }
1545  
1546 <        checkCompletedWithWrappedCFException(h, ex);
1546 >        checkCompletedWithWrappedException(h, ex);
1547          r.assertNotInvoked();
1548          checkCompletedNormally(fFirst ? f : g, v1);
1549 <        checkCompletedWithWrappedCFException(!fFirst ? f : g, ex);
1549 >        checkCompletedExceptionally(!fFirst ? f : g, ex);
1550      }}
1551  
1552      /**
# Line 1617 | Line 1660 | public class CompletableFutureTest exten
1660              (!fFirst ? f : g).completeExceptionally(ex);
1661          }
1662  
1663 <        checkCompletedWithWrappedCFException(h, ex);
1663 >        checkCompletedWithWrappedException(h, ex);
1664          r.assertNotInvoked();
1665          checkCompletedNormally(fFirst ? f : g, v1);
1666 <        checkCompletedWithWrappedCFException(!fFirst ? f : g, ex);
1666 >        checkCompletedExceptionally(!fFirst ? f : g, ex);
1667      }}
1668  
1669      /**
# Line 1752 | Line 1795 | public class CompletableFutureTest exten
1795          rs[0].assertNotInvoked();
1796          rs[1].assertNotInvoked();
1797          f.completeExceptionally(ex);
1798 <        checkCompletedWithWrappedCFException(h0, ex);
1799 <        checkCompletedWithWrappedCFException(h1, ex);
1798 >        checkCompletedWithWrappedException(h0, ex);
1799 >        checkCompletedWithWrappedException(h1, ex);
1800          final CompletableFuture<Integer> h2 = m.applyToEither(f, g, rs[2]);
1801          final CompletableFuture<Integer> h3 = m.applyToEither(g, f, rs[3]);
1802 <        checkCompletedWithWrappedCFException(h2, ex);
1803 <        checkCompletedWithWrappedCFException(h3, ex);
1802 >        checkCompletedWithWrappedException(h2, ex);
1803 >        checkCompletedWithWrappedException(h3, ex);
1804          g.complete(v1);
1805  
1806          // unspecified behavior - both source completions available
# Line 1767 | Line 1810 | public class CompletableFutureTest exten
1810              assertEquals(inc(v1), h4.join());
1811              rs[4].assertValue(inc(v1));
1812          } catch (CompletionException ok) {
1813 <            checkCompletedWithWrappedCFException(h4, ex);
1813 >            checkCompletedWithWrappedException(h4, ex);
1814              rs[4].assertNotInvoked();
1815          }
1816          try {
1817              assertEquals(inc(v1), h5.join());
1818              rs[5].assertValue(inc(v1));
1819          } catch (CompletionException ok) {
1820 <            checkCompletedWithWrappedCFException(h5, ex);
1820 >            checkCompletedWithWrappedException(h5, ex);
1821              rs[5].assertNotInvoked();
1822          }
1823  
1824 <        checkCompletedWithWrappedCFException(f, ex);
1824 >        checkCompletedExceptionally(f, ex);
1825          checkCompletedNormally(g, v1);
1826 <        checkCompletedWithWrappedCFException(h0, ex);
1827 <        checkCompletedWithWrappedCFException(h1, ex);
1828 <        checkCompletedWithWrappedCFException(h2, ex);
1829 <        checkCompletedWithWrappedCFException(h3, ex);
1830 <        checkCompletedWithWrappedCFException(h4, ex);
1826 >        checkCompletedWithWrappedException(h0, ex);
1827 >        checkCompletedWithWrappedException(h1, ex);
1828 >        checkCompletedWithWrappedException(h2, ex);
1829 >        checkCompletedWithWrappedException(h3, ex);
1830 >        checkCompletedWithWrappedException(h4, ex);
1831          for (int i = 0; i < 4; i++) rs[i].assertNotInvoked();
1832      }}
1833  
# Line 1816 | Line 1859 | public class CompletableFutureTest exten
1859              assertEquals(inc(v1), h0.join());
1860              rs[0].assertValue(inc(v1));
1861          } catch (CompletionException ok) {
1862 <            checkCompletedWithWrappedCFException(h0, ex);
1862 >            checkCompletedWithWrappedException(h0, ex);
1863              rs[0].assertNotInvoked();
1864          }
1865          try {
1866              assertEquals(inc(v1), h1.join());
1867              rs[1].assertValue(inc(v1));
1868          } catch (CompletionException ok) {
1869 <            checkCompletedWithWrappedCFException(h1, ex);
1869 >            checkCompletedWithWrappedException(h1, ex);
1870              rs[1].assertNotInvoked();
1871          }
1872          try {
1873              assertEquals(inc(v1), h2.join());
1874              rs[2].assertValue(inc(v1));
1875          } catch (CompletionException ok) {
1876 <            checkCompletedWithWrappedCFException(h2, ex);
1876 >            checkCompletedWithWrappedException(h2, ex);
1877              rs[2].assertNotInvoked();
1878          }
1879          try {
1880              assertEquals(inc(v1), h3.join());
1881              rs[3].assertValue(inc(v1));
1882          } catch (CompletionException ok) {
1883 <            checkCompletedWithWrappedCFException(h3, ex);
1883 >            checkCompletedWithWrappedException(h3, ex);
1884              rs[3].assertNotInvoked();
1885          }
1886  
1887          checkCompletedNormally(f, v1);
1888 <        checkCompletedWithWrappedCFException(g, ex);
1888 >        checkCompletedExceptionally(g, ex);
1889      }}
1890  
1891      /**
# Line 2071 | Line 2114 | public class CompletableFutureTest exten
2114          rs[0].assertNotInvoked();
2115          rs[1].assertNotInvoked();
2116          f.completeExceptionally(ex);
2117 <        checkCompletedWithWrappedCFException(h0, ex);
2118 <        checkCompletedWithWrappedCFException(h1, ex);
2117 >        checkCompletedWithWrappedException(h0, ex);
2118 >        checkCompletedWithWrappedException(h1, ex);
2119          final CompletableFuture<Void> h2 = m.acceptEither(f, g, rs[2]);
2120          final CompletableFuture<Void> h3 = m.acceptEither(g, f, rs[3]);
2121 <        checkCompletedWithWrappedCFException(h2, ex);
2122 <        checkCompletedWithWrappedCFException(h3, ex);
2121 >        checkCompletedWithWrappedException(h2, ex);
2122 >        checkCompletedWithWrappedException(h3, ex);
2123  
2124          g.complete(v1);
2125  
# Line 2087 | Line 2130 | public class CompletableFutureTest exten
2130              assertNull(h4.join());
2131              rs[4].assertValue(v1);
2132          } catch (CompletionException ok) {
2133 <            checkCompletedWithWrappedCFException(h4, ex);
2133 >            checkCompletedWithWrappedException(h4, ex);
2134              rs[4].assertNotInvoked();
2135          }
2136          try {
2137              assertNull(h5.join());
2138              rs[5].assertValue(v1);
2139          } catch (CompletionException ok) {
2140 <            checkCompletedWithWrappedCFException(h5, ex);
2140 >            checkCompletedWithWrappedException(h5, ex);
2141              rs[5].assertNotInvoked();
2142          }
2143  
2144 <        checkCompletedWithWrappedCFException(f, ex);
2144 >        checkCompletedExceptionally(f, ex);
2145          checkCompletedNormally(g, v1);
2146 <        checkCompletedWithWrappedCFException(h0, ex);
2147 <        checkCompletedWithWrappedCFException(h1, ex);
2148 <        checkCompletedWithWrappedCFException(h2, ex);
2149 <        checkCompletedWithWrappedCFException(h3, ex);
2150 <        checkCompletedWithWrappedCFException(h4, ex);
2146 >        checkCompletedWithWrappedException(h0, ex);
2147 >        checkCompletedWithWrappedException(h1, ex);
2148 >        checkCompletedWithWrappedException(h2, ex);
2149 >        checkCompletedWithWrappedException(h3, ex);
2150 >        checkCompletedWithWrappedException(h4, ex);
2151          for (int i = 0; i < 4; i++) rs[i].assertNotInvoked();
2152      }}
2153  
# Line 2136 | Line 2179 | public class CompletableFutureTest exten
2179              assertEquals(null, h0.join());
2180              rs[0].assertValue(v1);
2181          } catch (CompletionException ok) {
2182 <            checkCompletedWithWrappedCFException(h0, ex);
2182 >            checkCompletedWithWrappedException(h0, ex);
2183              rs[0].assertNotInvoked();
2184          }
2185          try {
2186              assertEquals(null, h1.join());
2187              rs[1].assertValue(v1);
2188          } catch (CompletionException ok) {
2189 <            checkCompletedWithWrappedCFException(h1, ex);
2189 >            checkCompletedWithWrappedException(h1, ex);
2190              rs[1].assertNotInvoked();
2191          }
2192          try {
2193              assertEquals(null, h2.join());
2194              rs[2].assertValue(v1);
2195          } catch (CompletionException ok) {
2196 <            checkCompletedWithWrappedCFException(h2, ex);
2196 >            checkCompletedWithWrappedException(h2, ex);
2197              rs[2].assertNotInvoked();
2198          }
2199          try {
2200              assertEquals(null, h3.join());
2201              rs[3].assertValue(v1);
2202          } catch (CompletionException ok) {
2203 <            checkCompletedWithWrappedCFException(h3, ex);
2203 >            checkCompletedWithWrappedException(h3, ex);
2204              rs[3].assertNotInvoked();
2205          }
2206  
2207          checkCompletedNormally(f, v1);
2208 <        checkCompletedWithWrappedCFException(g, ex);
2208 >        checkCompletedExceptionally(g, ex);
2209      }}
2210  
2211      /**
# Line 2331 | Line 2374 | public class CompletableFutureTest exten
2374          rs[0].assertNotInvoked();
2375          rs[1].assertNotInvoked();
2376          f.completeExceptionally(ex);
2377 <        checkCompletedWithWrappedCFException(h0, ex);
2378 <        checkCompletedWithWrappedCFException(h1, ex);
2377 >        checkCompletedWithWrappedException(h0, ex);
2378 >        checkCompletedWithWrappedException(h1, ex);
2379          final CompletableFuture<Void> h2 = m.runAfterEither(f, g, rs[2]);
2380          final CompletableFuture<Void> h3 = m.runAfterEither(g, f, rs[3]);
2381 <        checkCompletedWithWrappedCFException(h2, ex);
2382 <        checkCompletedWithWrappedCFException(h3, ex);
2381 >        checkCompletedWithWrappedException(h2, ex);
2382 >        checkCompletedWithWrappedException(h3, ex);
2383  
2384          g.complete(v1);
2385  
# Line 2347 | Line 2390 | public class CompletableFutureTest exten
2390              assertNull(h4.join());
2391              rs[4].assertInvoked();
2392          } catch (CompletionException ok) {
2393 <            checkCompletedWithWrappedCFException(h4, ex);
2393 >            checkCompletedWithWrappedException(h4, ex);
2394              rs[4].assertNotInvoked();
2395          }
2396          try {
2397              assertNull(h5.join());
2398              rs[5].assertInvoked();
2399          } catch (CompletionException ok) {
2400 <            checkCompletedWithWrappedCFException(h5, ex);
2400 >            checkCompletedWithWrappedException(h5, ex);
2401              rs[5].assertNotInvoked();
2402          }
2403  
2404 <        checkCompletedWithWrappedCFException(f, ex);
2404 >        checkCompletedExceptionally(f, ex);
2405          checkCompletedNormally(g, v1);
2406 <        checkCompletedWithWrappedCFException(h0, ex);
2407 <        checkCompletedWithWrappedCFException(h1, ex);
2408 <        checkCompletedWithWrappedCFException(h2, ex);
2409 <        checkCompletedWithWrappedCFException(h3, ex);
2410 <        checkCompletedWithWrappedCFException(h4, ex);
2406 >        checkCompletedWithWrappedException(h0, ex);
2407 >        checkCompletedWithWrappedException(h1, ex);
2408 >        checkCompletedWithWrappedException(h2, ex);
2409 >        checkCompletedWithWrappedException(h3, ex);
2410 >        checkCompletedWithWrappedException(h4, ex);
2411          for (int i = 0; i < 4; i++) rs[i].assertNotInvoked();
2412      }}
2413  
# Line 2396 | Line 2439 | public class CompletableFutureTest exten
2439              assertEquals(null, h0.join());
2440              rs[0].assertInvoked();
2441          } catch (CompletionException ok) {
2442 <            checkCompletedWithWrappedCFException(h0, ex);
2442 >            checkCompletedWithWrappedException(h0, ex);
2443              rs[0].assertNotInvoked();
2444          }
2445          try {
2446              assertEquals(null, h1.join());
2447              rs[1].assertInvoked();
2448          } catch (CompletionException ok) {
2449 <            checkCompletedWithWrappedCFException(h1, ex);
2449 >            checkCompletedWithWrappedException(h1, ex);
2450              rs[1].assertNotInvoked();
2451          }
2452          try {
2453              assertEquals(null, h2.join());
2454              rs[2].assertInvoked();
2455          } catch (CompletionException ok) {
2456 <            checkCompletedWithWrappedCFException(h2, ex);
2456 >            checkCompletedWithWrappedException(h2, ex);
2457              rs[2].assertNotInvoked();
2458          }
2459          try {
2460              assertEquals(null, h3.join());
2461              rs[3].assertInvoked();
2462          } catch (CompletionException ok) {
2463 <            checkCompletedWithWrappedCFException(h3, ex);
2463 >            checkCompletedWithWrappedException(h3, ex);
2464              rs[3].assertNotInvoked();
2465          }
2466  
2467          checkCompletedNormally(f, v1);
2468 <        checkCompletedWithWrappedCFException(g, ex);
2468 >        checkCompletedExceptionally(g, ex);
2469      }}
2470  
2471      /**
# Line 2549 | Line 2592 | public class CompletableFutureTest exten
2592          final CompletableFuture<Integer> g = m.thenCompose(f, r);
2593          if (createIncomplete) f.completeExceptionally(ex);
2594  
2595 <        checkCompletedWithWrappedCFException(g, ex);
2596 <        checkCompletedWithWrappedCFException(f, ex);
2595 >        checkCompletedWithWrappedException(g, ex);
2596 >        checkCompletedExceptionally(f, ex);
2597          r.assertNotInvoked();
2598      }}
2599  
# Line 2821 | Line 2864 | public class CompletableFutureTest exten
2864          final CompletableFuture<Integer> g = m.whenComplete
2865              (f,
2866               (Integer x, Throwable t) -> {
2867 +                m.checkExecutionMode();
2868                  threadAssertSame(x, v1);
2869                  threadAssertNull(t);
2870                  a.getAndIncrement();
# Line 2848 | Line 2892 | public class CompletableFutureTest exten
2892          final CompletableFuture<Integer> g = m.whenComplete
2893              (f,
2894               (Integer x, Throwable t) -> {
2895 +                m.checkExecutionMode();
2896                  threadAssertNull(x);
2897                  threadAssertSame(t, ex);
2898                  a.getAndIncrement();
2899              });
2900          if (createIncomplete) f.completeExceptionally(ex);
2901 <        checkCompletedWithWrappedCFException(f, ex);
2902 <        checkCompletedWithWrappedCFException(g, ex);
2901 >        checkCompletedExceptionally(f, ex);
2902 >        checkCompletedWithWrappedException(g, ex);
2903          assertEquals(1, a.get());
2904      }}
2905  
# Line 2873 | Line 2918 | public class CompletableFutureTest exten
2918          final CompletableFuture<Integer> g = m.whenComplete
2919              (f,
2920               (Integer x, Throwable t) -> {
2921 +                m.checkExecutionMode();
2922                  threadAssertNull(x);
2923                  threadAssertTrue(t instanceof CancellationException);
2924                  a.getAndIncrement();
2925              });
2926          if (createIncomplete) assertTrue(f.cancel(mayInterruptIfRunning));
2927  
2882        //try { g.join(); } catch (Throwable t) { throw new Error(t); }
2928          checkCompletedWithWrappedCancellationException(g);
2929          checkCancelled(f);
2930          assertEquals(1, a.get());
# Line 2901 | Line 2946 | public class CompletableFutureTest exten
2946          final CompletableFuture<Integer> g = m.whenComplete
2947              (f,
2948               (Integer x, Throwable t) -> {
2949 +                m.checkExecutionMode();
2950                  threadAssertSame(x, v1);
2951                  threadAssertNull(t);
2952                  a.getAndIncrement();
# Line 2908 | Line 2954 | public class CompletableFutureTest exten
2954              });
2955          if (createIncomplete) f.complete(v1);
2956          checkCompletedNormally(f, v1);
2957 <        checkCompletedWithWrappedCFException(g, ex);
2957 >        checkCompletedWithWrappedException(g, ex);
2958          assertEquals(1, a.get());
2959      }}
2960  
# Line 2931 | Line 2977 | public class CompletableFutureTest exten
2977          final CompletableFuture<Integer> g = m.whenComplete
2978              (f,
2979               (Integer x, Throwable t) -> {
2980 +                m.checkExecutionMode();
2981                  threadAssertSame(t, ex1);
2982                  threadAssertNull(x);
2983                  a.getAndIncrement();
# Line 2938 | Line 2985 | public class CompletableFutureTest exten
2985              });
2986          if (createIncomplete) f.completeExceptionally(ex1);
2987  
2988 <        checkCompletedWithWrappedCFException(f, ex1);
2989 <        checkCompletedWithWrappedCFException(g, ex1);
2988 >        checkCompletedExceptionally(f, ex1);
2989 >        checkCompletedWithWrappedException(g, ex1);
2990          assertEquals(1, a.get());
2991      }}
2992  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines