Code example for CountDownLatch

Methods: countDown, getCount

0
    } 
 
    @Threaded 
    public void thread3() { 
        waitForTick(1); 
        assertEquals(1, c.getCount());
        waitForTick(2); // advances quickly 
        assertEquals(1, c.getCount());
        c.countDown();
    } 
 
    @Test 
    public void finish() { 
        assertEquals(0, c.getCount());
    } 
}