6 |
|
*/ |
7 |
|
|
8 |
|
import junit.framework.*; |
9 |
– |
import java.util.concurrent.Semaphore; |
9 |
|
|
10 |
< |
/** |
12 |
< |
* Test java.lang.Thread |
13 |
< |
* |
14 |
< |
*/ |
15 |
< |
|
16 |
< |
public class ThreadTest extends TestCase { |
10 |
> |
public class ThreadTest extends JSR166TestCase { |
11 |
|
public static void main(String[] args) { |
12 |
|
junit.textui.TestRunner.run(suite()); |
13 |
|
} |
27 |
|
// dependencies across tests |
28 |
|
Thread current = Thread.currentThread(); |
29 |
|
ThreadGroup tg = current.getThreadGroup(); |
36 |
– |
assertNull(Thread.getDefaultUncaughtExceptionHandler()); |
37 |
– |
assertEquals(tg, current.getUncaughtExceptionHandler()); |
30 |
|
MyHandler eh = new MyHandler(); |
39 |
– |
Thread.setDefaultUncaughtExceptionHandler(eh); |
40 |
– |
assertEquals(eh, current.getUncaughtExceptionHandler()); |
41 |
– |
assertEquals(eh, Thread.getDefaultUncaughtExceptionHandler()); |
42 |
– |
Thread.setDefaultUncaughtExceptionHandler(null); |
43 |
– |
assertNull(Thread.getDefaultUncaughtExceptionHandler()); |
31 |
|
assertEquals(tg, current.getUncaughtExceptionHandler()); |
32 |
|
current.setUncaughtExceptionHandler(eh); |
33 |
|
assertEquals(eh, current.getUncaughtExceptionHandler()); |