@Test
public void testCallingThreadIsBlockedUntilAllTaskCompletes()
        throws InterruptedException {

    long ts = Time.now();
    service.await(new Runnable() {
        @Override
        public void run() {
            Threads.sleep(100);
        }
    }, new Runnable() {
        @Override
        public void run() {
            Threads.sleep(50);
        }
    }, new Runnable() {
        @Override
        public void run() {
            Threads.sleep(150);
        }
    });
    long elapsed = Time.now() - ts;
    Assert.assertTrue(TimeUnit.MILLISECONDS.convert(elapsed,
            TimeUnit.MICROSECONDS) >= 150);
    Assert.assertTrue(TimeUnit.MILLISECONDS.convert(elapsed,
            TimeUnit.MICROSECONDS) <= 300);
}