75 |
|
try { |
76 |
|
f.join(); |
77 |
|
shouldThrow(); |
78 |
< |
} catch (Throwable ex) { |
79 |
< |
assertTrue(ex instanceof CompletionException && |
80 |
< |
((CompletionException)ex).getCause() instanceof CFException); |
78 |
> |
} catch (CompletionException success) { |
79 |
> |
assertTrue(success.getCause() instanceof CFException); |
80 |
|
} |
81 |
|
try { |
82 |
|
f.getNow(null); |
83 |
|
shouldThrow(); |
84 |
< |
} catch (Throwable ex) { |
85 |
< |
assertTrue(ex instanceof CompletionException && |
87 |
< |
((CompletionException)ex).getCause() instanceof CFException); |
84 |
> |
} catch (CompletionException success) { |
85 |
> |
assertTrue(success.getCause() instanceof CFException); |
86 |
|
} |
87 |
|
try { |
88 |
|
f.get(); |
89 |
|
shouldThrow(); |
90 |
< |
} catch (Throwable ex) { |
91 |
< |
assertTrue(ex instanceof ExecutionException && |
92 |
< |
((ExecutionException)ex).getCause() instanceof CFException); |
95 |
< |
} |
90 |
> |
} catch (ExecutionException success) { |
91 |
> |
assertTrue(success.getCause() instanceof CFException); |
92 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
93 |
|
try { |
94 |
|
f.get(0L, SECONDS); |
95 |
|
shouldThrow(); |
96 |
< |
} catch (Throwable ex) { |
97 |
< |
assertTrue(ex instanceof ExecutionException && |
98 |
< |
((ExecutionException)ex).getCause() instanceof CFException); |
102 |
< |
} |
96 |
> |
} catch (ExecutionException success) { |
97 |
> |
assertTrue(success.getCause() instanceof CFException); |
98 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
99 |
|
assertTrue(f.isDone()); |
100 |
|
assertFalse(f.isCancelled()); |
101 |
|
} |
104 |
|
try { |
105 |
|
f.join(); |
106 |
|
shouldThrow(); |
107 |
< |
} catch (Throwable ex) { |
112 |
< |
assertTrue(ex instanceof CancellationException); |
113 |
< |
} |
107 |
> |
} catch (CancellationException success) {} |
108 |
|
try { |
109 |
|
f.getNow(null); |
110 |
|
shouldThrow(); |
111 |
< |
} catch (Throwable ex) { |
118 |
< |
assertTrue(ex instanceof CancellationException); |
119 |
< |
} |
111 |
> |
} catch (CancellationException success) {} |
112 |
|
try { |
113 |
|
f.get(); |
114 |
|
shouldThrow(); |
115 |
< |
} catch (Throwable ex) { |
116 |
< |
assertTrue(ex instanceof CancellationException); |
125 |
< |
} |
115 |
> |
} catch (CancellationException success) { |
116 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
117 |
|
try { |
118 |
|
f.get(0L, SECONDS); |
119 |
|
shouldThrow(); |
120 |
< |
} catch (Throwable ex) { |
121 |
< |
assertTrue(ex instanceof CancellationException); |
131 |
< |
} |
120 |
> |
} catch (CancellationException success) { |
121 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
122 |
|
assertTrue(f.isDone()); |
123 |
|
assertTrue(f.isCancelled()); |
124 |
|
} |
127 |
|
try { |
128 |
|
f.join(); |
129 |
|
shouldThrow(); |
130 |
< |
} catch (Throwable ex) { |
131 |
< |
assertTrue(ex instanceof CompletionException && |
142 |
< |
((CompletionException)ex).getCause() instanceof CancellationException); |
130 |
> |
} catch (CompletionException success) { |
131 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
132 |
|
} |
133 |
|
try { |
134 |
|
f.getNow(null); |
135 |
|
shouldThrow(); |
136 |
< |
} catch (Throwable ex) { |
137 |
< |
assertTrue(ex instanceof CompletionException && |
149 |
< |
((CompletionException)ex).getCause() instanceof CancellationException); |
136 |
> |
} catch (CompletionException success) { |
137 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
138 |
|
} |
139 |
|
try { |
140 |
|
f.get(); |
141 |
|
shouldThrow(); |
142 |
< |
} catch (Throwable ex) { |
143 |
< |
assertTrue(ex instanceof ExecutionException && |
144 |
< |
((ExecutionException)ex).getCause() instanceof CancellationException); |
157 |
< |
} |
142 |
> |
} catch (ExecutionException success) { |
143 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
144 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
145 |
|
try { |
146 |
|
f.get(0L, SECONDS); |
147 |
|
shouldThrow(); |
148 |
< |
} catch (Throwable ex) { |
149 |
< |
assertTrue(ex instanceof ExecutionException && |
150 |
< |
((ExecutionException)ex).getCause() instanceof CancellationException); |
164 |
< |
} |
148 |
> |
} catch (ExecutionException success) { |
149 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
150 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
151 |
|
assertTrue(f.isDone()); |
152 |
|
assertFalse(f.isCancelled()); |
153 |
|
} |
442 |
|
assertTrue(r.ran); |
443 |
|
} |
444 |
|
|
445 |
< |
// seq conmpletion methods |
445 |
> |
// seq completion methods |
446 |
|
|
447 |
|
/** |
448 |
|
* thenRun result completes normally after normal completion of source |
1657 |
|
} |
1658 |
|
|
1659 |
|
/** |
1660 |
< |
* thenCompse result completes normally after normal completion of source |
1660 |
> |
* thenComposeAsync result completes normally after normal |
1661 |
> |
* completion of source |
1662 |
|
*/ |
1663 |
|
public void testThenComposeAsync() { |
1664 |
|
CompletableFuture<Integer> f = new CompletableFuture<Integer>(); |
1669 |
|
} |
1670 |
|
|
1671 |
|
/** |
1672 |
< |
* thenComposeAsync result completes exceptionally after exceptional |
1673 |
< |
* completion of source |
1672 |
> |
* thenComposeAsync result completes exceptionally after |
1673 |
> |
* exceptional completion of source |
1674 |
|
*/ |
1675 |
|
public void testThenComposeAsync2() { |
1676 |
|
CompletableFuture<Integer> f = new CompletableFuture<Integer>(); |
1703 |
|
} |
1704 |
|
|
1705 |
|
|
1706 |
< |
// aaync with explicit executors |
1706 |
> |
// async with explicit executors |
1707 |
|
|
1708 |
|
/** |
1709 |
|
* thenRunAsync result completes normally after normal completion of source |
2280 |
|
} |
2281 |
|
|
2282 |
|
/** |
2283 |
< |
* thenCompse result completes normally after normal completion of source |
2283 |
> |
* thenComposeAsync result completes normally after normal |
2284 |
> |
* completion of source |
2285 |
|
*/ |
2286 |
|
public void testThenComposeAsyncE() { |
2287 |
|
CompletableFuture<Integer> f = new CompletableFuture<Integer>(); |
2292 |
|
} |
2293 |
|
|
2294 |
|
/** |
2295 |
< |
* thenComposeAsync result completes exceptionally after exceptional |
2296 |
< |
* completion of source |
2295 |
> |
* thenComposeAsync result completes exceptionally after |
2296 |
> |
* exceptional completion of source |
2297 |
|
*/ |
2298 |
|
public void testThenComposeAsync2E() { |
2299 |
|
CompletableFuture<Integer> f = new CompletableFuture<Integer>(); |