/** getQueuedThreads returns all waiting threads */
 public void testGetQueuedThreads() {
   final Mutex sync = new Mutex();
   Thread t1 = new Thread(new InterruptedSyncRunnable(sync));
   Thread t2 = new Thread(new InterruptibleSyncRunnable(sync));
   assertHasExclusiveQueuedThreads(sync, NO_THREADS);
   sync.acquire();
   assertHasExclusiveQueuedThreads(sync, NO_THREADS);
   t1.start();
   waitForQueuedThread(sync, t1);
   assertHasExclusiveQueuedThreads(sync, t1);
   assertTrue(sync.getQueuedThreads().contains(t1));
   assertFalse(sync.getQueuedThreads().contains(t2));
   t2.start();
   waitForQueuedThread(sync, t2);
   assertHasExclusiveQueuedThreads(sync, t1, t2);
   assertTrue(sync.getQueuedThreads().contains(t1));
   assertTrue(sync.getQueuedThreads().contains(t2));
   t1.interrupt();
   awaitTermination(t1);
   assertHasExclusiveQueuedThreads(sync, t2);
   sync.release();
   awaitTermination(t2);
   assertHasExclusiveQueuedThreads(sync, NO_THREADS);
 }