ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadLocalTest.java
Revision: 1.1
Committed: Sun Aug 31 19:24:56 2003 UTC (20 years, 8 months ago) by dl
Branch: MAIN
Log Message:
First check-in of tests to be in tck

File Contents

# User Rev Content
1 dl 1.1 /*
2     * Written by members of JCP JSR-166 Expert Group and released to the
3     * public domain. Use, modify, and redistribute this code in any way
4     * without acknowledgement. Other contributors include Andrew Wright,
5     * Jeffrey Hayes, Pat Fischer, Mike Judd.
6     */
7    
8     import junit.framework.*;
9     import java.util.concurrent.Semaphore;
10    
11     public class ThreadLocalTest extends TestCase {
12     public static void main(String[] args) {
13     junit.textui.TestRunner.run(suite());
14     }
15    
16     public static Test suite() {
17     return new TestSuite(ThreadLocalTest.class);
18     }
19    
20     static ThreadLocal tl = new ThreadLocal() {
21     public Object initialValue() {
22     return new Integer(1);
23     }
24     };
25    
26    
27     public void testRemove() {
28     Integer one = new Integer(1);
29     Integer two = new Integer(2);
30     assertEquals(tl.get(), one);
31     tl.set(two);
32     assertEquals(tl.get(), two);
33     tl.remove();
34     assertEquals(tl.get(), one);
35     }
36     }
37