ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutor9Test.java
Revision: 1.2
Committed: Wed Dec 31 16:44:02 2014 UTC (9 years, 4 months ago) by jsr166
Branch: MAIN
Changes since 1.1: +0 -1 lines
Log Message:
remove unused imports

File Contents

# User Rev Content
1 jsr166 1.1 /*
2     * Written by Martin Buchholz and Doug Lea with assistance from
3     * members of JCP JSR-166 Expert Group and released to the public
4     * domain, as explained at
5     * http://creativecommons.org/publicdomain/zero/1.0/
6     */
7    
8     import junit.framework.*;
9     import java.util.concurrent.*;
10     import static java.util.concurrent.TimeUnit.MILLISECONDS;
11     import java.util.*;
12    
13     public class ThreadPoolExecutor9Test extends JSR166TestCase {
14     public static void main(String[] args) {
15     junit.textui.TestRunner.run(suite());
16     }
17     public static Test suite() {
18     return new TestSuite(ThreadPoolExecutor9Test.class);
19     }
20    
21     /**
22     * Configuration changes that allow core pool size greater than
23     * max pool size result in IllegalArgumentException.
24     */
25     public void testPoolSizeInvariants() {
26     ThreadPoolExecutor p =
27     new ThreadPoolExecutor(1, 1,
28     LONG_DELAY_MS, MILLISECONDS,
29     new ArrayBlockingQueue<Runnable>(10));
30     for (int s = 1; s < 5; s++) {
31     p.setMaximumPoolSize(s);
32     p.setCorePoolSize(s);
33     try {
34     p.setMaximumPoolSize(s - 1);
35     shouldThrow();
36     } catch (IllegalArgumentException success) {}
37     assertEquals(s, p.getCorePoolSize());
38     assertEquals(s, p.getMaximumPoolSize());
39     try {
40     p.setCorePoolSize(s + 1);
41     shouldThrow();
42     } catch (IllegalArgumentException success) {}
43     assertEquals(s, p.getCorePoolSize());
44     assertEquals(s, p.getMaximumPoolSize());
45     }
46     joinPool(p);
47     }
48    
49     }