ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadLocalTest.java
Revision: 1.3
Committed: Sat Sep 20 18:20:08 2003 UTC (20 years, 7 months ago) by dl
Branch: MAIN
CVS Tags: JSR166_NOV3_FREEZE, JSR166_DEC9_PRE_ES_SUBMIT, JSR166_DEC9_POST_ES_SUBMIT
Changes since 1.2: +3 -0 lines
Log Message:
Documentation scaffolding

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 dl 1.3 /**
28     * remove causes next access to return initial value
29     */
30 dl 1.1 public void testRemove() {
31     Integer one = new Integer(1);
32     Integer two = new Integer(2);
33     assertEquals(tl.get(), one);
34     tl.set(two);
35     assertEquals(tl.get(), two);
36     tl.remove();
37     assertEquals(tl.get(), one);
38     }
39     }
40