public void testGetsEmptyContextForUnknownThread() { assertEquals(0, context.forThread(new Thread()).size()); }
public void testCanAccessOtherThreadsContext() throws InterruptedException { final String testKey = "vanity"; final Object testValue = new Object(); final CountDownLatch finished = new CountDownLatch(1); final Thread otherThread = new Thread(new Runnable() { public void run() { context.put(testKey, testValue); finished.countDown(); } }); otherThread.start(); finished.await(); Map<String, Object> forThread = context.forThread(otherThread); assertEquals(1, forThread.size()); assertEquals(testValue, forThread.get(testKey)); }