41 |
|
import java.util.function.Predicate; |
42 |
|
import java.util.function.Supplier; |
43 |
|
|
44 |
– |
import junit.framework.AssertionFailedError; |
44 |
|
import junit.framework.Test; |
45 |
|
import junit.framework.TestSuite; |
46 |
|
|
59 |
|
assertFalse(f.isDone()); |
60 |
|
assertFalse(f.isCancelled()); |
61 |
|
assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]")); |
62 |
+ |
|
63 |
+ |
Object result = null; |
64 |
|
try { |
65 |
< |
assertNull(f.getNow(null)); |
65 |
> |
result = f.getNow(null); |
66 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
67 |
+ |
assertNull(result); |
68 |
+ |
|
69 |
|
try { |
70 |
|
f.get(randomExpiredTimeout(), randomTimeUnit()); |
71 |
|
shouldThrow(); |
295 |
|
} |
296 |
|
|
297 |
|
f = new CompletableFuture<>(); |
298 |
< |
f.completeExceptionally(ex = new CFException()); |
298 |
> |
f.completeExceptionally(new CFException()); |
299 |
|
f.obtrudeValue(v1); |
300 |
|
checkCompletedNormally(f, v1); |
301 |
|
f.obtrudeException(ex = new CFException()); |
4193 |
|
static void assertZero(CompletableFuture<?> f) { |
4194 |
|
try { |
4195 |
|
f.getNow(null); |
4196 |
< |
throw new AssertionFailedError("should throw"); |
4196 |
> |
throw new AssertionError("should throw"); |
4197 |
|
} catch (CompletionException success) { |
4198 |
|
assertTrue(success.getCause() instanceof ZeroException); |
4199 |
|
} |
4392 |
|
f.complete(null); |
4393 |
|
|
4394 |
|
f = new CompletableFuture<>(); |
4395 |
< |
CompletableFuture.anyOf(new CompletableFuture<?>[] { f, incomplete }); |
4395 |
> |
CompletableFuture.anyOf(f, incomplete); |
4396 |
|
f.complete(null); |
4397 |
|
} |
4398 |
|
|
4410 |
|
f.complete(null); |
4411 |
|
|
4412 |
|
f = new CompletableFuture<>(); |
4413 |
< |
CompletableFuture.anyOf(new CompletableFuture<?>[] { incomplete, f }); |
4413 |
> |
CompletableFuture.anyOf(incomplete, f); |
4414 |
|
f.complete(null); |
4415 |
|
} |
4416 |
|
} |