public void test_parkFor_2() throws Exception {
  CyclicBarrier barrier=new CyclicBarrier(2);
  Parker parker=new Parker(barrier,false,1000);
  Thread parkerThread=new Thread(parker);
  Thread waiterThread=new Thread(new WaitAndUnpark(barrier,300,parkerThread));
  parkerThread.start();
  waiterThread.start();
  parker.assertDurationIsInRange(300);
  waiterThread.join();
  parkerThread.join();
}

public void test_parkFor_2 ( ) throws Exception { CyclicBarrier barrier = new CyclicBarrier ( 2 ) ; Parker parker = new Parker ( barrier , false , 1000 ) ; Thread parkerThread = new Thread ( parker ) ; Thread waiterThread = new Thread ( new WaitAndUnpark ( barrier , 300 , parkerThread ) ) ; parkerThread . start ( ) ; waiterThread . start ( ) ; parker . assertDurationIsInRange ( 300 ) ; waiterThread . join ( ) ; parkerThread . join ( ) ; }
test the case where the unpark happens before the timeout .
