11 |
|
|
12 |
|
public class ThreadLocalTest extends JSR166TestCase { |
13 |
|
public static void main(String[] args) { |
14 |
< |
junit.textui.TestRunner.run(suite()); |
14 |
> |
junit.textui.TestRunner.run(suite()); |
15 |
|
} |
16 |
|
|
17 |
|
public static Test suite() { |
18 |
< |
return new TestSuite(ThreadLocalTest.class); |
18 |
> |
return new TestSuite(ThreadLocalTest.class); |
19 |
|
} |
20 |
|
|
21 |
|
static ThreadLocal<Integer> tl = new ThreadLocal<Integer>() { |
88 |
|
/** |
89 |
|
* InheritableThreadLocal propagates generic values. |
90 |
|
*/ |
91 |
< |
public void testGenericITL() { |
91 |
> |
public void testGenericITL() throws InterruptedException { |
92 |
|
final int threadCount = 10; |
93 |
|
final int x[] = new int[threadCount]; |
94 |
|
Thread progenitor = new ITLThread(x); |
95 |
< |
try { |
96 |
< |
progenitor.start(); |
97 |
< |
progenitor.join(); |
98 |
< |
for (int i = 0; i < threadCount; i++) { |
99 |
< |
assertEquals(i, x[i]); |
100 |
< |
} |
101 |
< |
} catch (InterruptedException e) { |
102 |
< |
unexpectedException(e); |
95 |
> |
progenitor.start(); |
96 |
> |
progenitor.join(); |
97 |
> |
for (int i = 0; i < threadCount; i++) { |
98 |
> |
assertEquals(i, x[i]); |
99 |
|
} |
100 |
|
} |
101 |
|
} |