6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
– |
import junit.framework.*; |
10 |
– |
import java.util.*; |
11 |
– |
import java.util.concurrent.*; |
9 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
10 |
< |
import java.util.concurrent.atomic.*; |
11 |
< |
import java.math.BigInteger; |
12 |
< |
import java.security.*; |
10 |
> |
|
11 |
> |
import java.util.concurrent.ArrayBlockingQueue; |
12 |
> |
import java.util.concurrent.Callable; |
13 |
> |
import java.util.concurrent.ExecutorCompletionService; |
14 |
> |
import java.util.concurrent.Executors; |
15 |
> |
import java.util.concurrent.ExecutorService; |
16 |
> |
import java.util.concurrent.Future; |
17 |
> |
import java.util.concurrent.FutureTask; |
18 |
> |
import java.util.concurrent.RunnableFuture; |
19 |
> |
import java.util.concurrent.ThreadPoolExecutor; |
20 |
> |
import java.util.concurrent.TimeUnit; |
21 |
> |
import java.util.concurrent.atomic.AtomicBoolean; |
22 |
> |
|
23 |
> |
import junit.framework.Test; |
24 |
> |
import junit.framework.TestSuite; |
25 |
|
|
26 |
|
public class ExecutorCompletionServiceTest extends JSR166TestCase { |
27 |
|
public static void main(String[] args) { |
28 |
< |
junit.textui.TestRunner.run(suite()); |
28 |
> |
main(suite(), args); |
29 |
|
} |
30 |
|
public static Test suite() { |
31 |
|
return new TestSuite(ExecutorCompletionServiceTest.class); |
36 |
|
*/ |
37 |
|
public void testConstructorNPE() { |
38 |
|
try { |
39 |
< |
ExecutorCompletionService ecs = new ExecutorCompletionService(null); |
39 |
> |
new ExecutorCompletionService(null); |
40 |
|
shouldThrow(); |
41 |
|
} catch (NullPointerException success) {} |
42 |
|
} |
47 |
|
public void testConstructorNPE2() { |
48 |
|
try { |
49 |
|
ExecutorService e = Executors.newCachedThreadPool(); |
50 |
< |
ExecutorCompletionService ecs = new ExecutorCompletionService(e, null); |
50 |
> |
new ExecutorCompletionService(e, null); |
51 |
|
shouldThrow(); |
52 |
|
} catch (NullPointerException success) {} |
53 |
|
} |