public class TestUtil {

    public static AsyncTest createAsyncTest() {
        return new AsyncTest();
    }

    public static class AsyncTest<T> {
        private T result;
        private CountDownLatch countDownLatch=new CountDownLatch(1);

        public T getResult() throws InterruptedException {
            countDownLatch.await();
            return result;
        }

        public void setResult(T result) {
            this.result = result;
            countDownLatch.countDown();
        }
    }
}