ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CompletableFutureTest.java
Revision: 1.3
Committed: Sat Feb 9 19:33:08 2013 UTC (11 years, 3 months ago) by jsr166
Branch: MAIN
Changes since 1.2: +5 -0 lines
Log Message:
nag tck maintainers

File Contents

# Content
1 /*
2 * Written by Doug Lea with assistance from members of JCP JSR-166
3 * Expert Group and released to the public domain, as explained at
4 * http://creativecommons.org/publicdomain/zero/1.0/
5 * Other contributors include Andrew Wright, Jeffrey Hayes,
6 * Pat Fisher, Mike Judd.
7 */
8
9 import junit.framework.*;
10 import java.util.concurrent.Callable;
11 import java.util.concurrent.CancellationException;
12 import java.util.concurrent.CountDownLatch;
13 import java.util.concurrent.ExecutionException;
14 import java.util.concurrent.Future;
15 import java.util.concurrent.CompletableFuture;
16 import java.util.concurrent.TimeoutException;
17 import java.util.concurrent.atomic.AtomicInteger;
18 import static java.util.concurrent.TimeUnit.MILLISECONDS;
19 import static java.util.concurrent.TimeUnit.SECONDS;
20 import java.util.*;
21
22 public class CompletableFutureTest extends JSR166TestCase {
23
24 public static void main(String[] args) {
25 junit.textui.TestRunner.run(suite());
26 }
27 public static Test suite() {
28 return new TestSuite(CompletableFutureTest.class);
29 }
30
31 // XXXX Just a skeleton implementation for now.
32 public void testTODO() {
33 fail("Please add some real tests!");
34 }
35
36 public void testToString() {
37 CompletableFuture<String> f;
38
39 f = new CompletableFuture<String>();
40 assertTrue(f.toString().contains("[Not completed]"));
41
42 f.complete("foo");
43 assertTrue(f.toString().contains("[Completed normally]"));
44
45 f = new CompletableFuture<String>();
46 f.completeExceptionally(new IndexOutOfBoundsException());
47 assertTrue(f.toString().contains("[Completed exceptionally]"));
48 }
49 }