ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadLocalTest.java
Revision: 1.2
Committed: Sun Sep 14 20:42:41 2003 UTC (20 years, 7 months ago) by dl
Branch: MAIN
Changes since 1.1: +1 -1 lines
Log Message:
New base class JSR166TestCase

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 dl 1.2 public class ThreadLocalTest extends JSR166TestCase {
12 dl 1.1 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