/** hasQueuedThreads reports whether there are waiting threads */
 public void testHasQueuedThreads() {
   final Mutex sync = new Mutex();
   assertFalse(sync.hasQueuedThreads());
   sync.acquire();
   Thread t1 = newStartedThread(new InterruptedSyncRunnable(sync));
   waitForQueuedThread(sync, t1);
   assertTrue(sync.hasQueuedThreads());
   Thread t2 = newStartedThread(new InterruptibleSyncRunnable(sync));
   waitForQueuedThread(sync, t2);
   assertTrue(sync.hasQueuedThreads());
   t1.interrupt();
   awaitTermination(t1);
   assertTrue(sync.hasQueuedThreads());
   sync.release();
   awaitTermination(t2);
   assertFalse(sync.hasQueuedThreads());
 }