--- jsr166/src/test/tck/ThreadLocalTest.java 2009/11/21 10:25:05 1.10 +++ jsr166/src/test/tck/ThreadLocalTest.java 2014/12/31 19:05:43 1.15 @@ -1,13 +1,13 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ -import junit.framework.*; -import java.util.concurrent.Semaphore; +import junit.framework.Test; +import junit.framework.TestSuite; public class ThreadLocalTest extends JSR166TestCase { public static void main(String[] args) { @@ -39,11 +39,11 @@ public class ThreadLocalTest extends JSR * remove causes next access to return initial value */ public void testRemove() { - assertEquals(tl.get(), one); + assertSame(tl.get(), one); tl.set(two); - assertEquals(tl.get(), two); + assertSame(tl.get(), two); tl.remove(); - assertEquals(tl.get(), one); + assertSame(tl.get(), one); } /** @@ -51,11 +51,11 @@ public class ThreadLocalTest extends JSR * initial value */ public void testRemoveITL() { - assertEquals(itl.get(), zero); + assertSame(itl.get(), zero); itl.set(two); - assertEquals(itl.get(), two); + assertSame(itl.get(), two); itl.remove(); - assertEquals(itl.get(), zero); + assertSame(itl.get(), zero); } private class ITLThread extends Thread { @@ -67,12 +67,12 @@ public class ThreadLocalTest extends JSR child = new ITLThread(x); child.start(); } - Thread.currentThread().yield(); + Thread.yield(); int threadId = itl.get().intValue(); for (int j = 0; j < threadId; j++) { x[threadId]++; - Thread.currentThread().yield(); + Thread.yield(); } if (child != null) { // Wait for child (if any)