public void thread1() throws InterruptedException {
   sync.acquire(1);
   assertFalse(sync.hasWaiters(c));
   assertEquals(0, sync.getWaitQueueLength(c));
   c.await();
   assertTick(1);
   sync.release(1);
 }
    public void thread2() throws InterruptedException {
      waitForTick(2);
      sync.acquire(1);
      assertFalse(sync.getWaitingThreads(c).isEmpty());
      c.await();

      assertTick(3);
      sync.release(1);
    }
 public void thread1() {
   try {
     sync.acquire(1);
     c.await();
     sync.release(1);
     fail("should throw exception");
   } catch (InterruptedException success) {
     assertTick(1);
   }
 }
    public void thread2() throws InterruptedException {
      waitForTick(1);
      sync.acquire(1);
      assertTrue(sync.hasWaiters(c));
      assertEquals(1, sync.getWaitQueueLength(c));
      c.await();

      assertTick(2);
      sync.release(1);
    }
 public void thread2() throws InterruptedException {
   sync.acquire(1);
   c.await();
   assertTick(1);
   sync.release(1);
 }