Methods Summary |
---|
public static void | main(java.lang.String[] args)
junit.textui.TestRunner.run(suite());
|
public static junit.framework.Test | suite()
return new TestSuite(ThreadLocalTest.class);
|
public void | testGenericITL()InheritableThreadLocal propagates generic values.
final int threadCount = 10;
final int x[] = new int[threadCount];
Thread progenitor = new ITLThread(x);
try {
progenitor.start();
progenitor.join();
for(int i = 0; i < threadCount; i++) {
assertEquals(i, x[i]);
}
} catch(InterruptedException e) {
unexpectedException();
}
|
public void | testRemove()remove causes next access to return initial value
assertEquals(tl.get(), one);
tl.set(two);
assertEquals(tl.get(), two);
tl.remove();
assertEquals(tl.get(), one);
|
public void | testRemoveITL()remove in InheritableThreadLocal causes next access to return
initial value
assertEquals(itl.get(), zero);
itl.set(two);
assertEquals(itl.get(), two);
itl.remove();
assertEquals(itl.get(), zero);
|