public static void waitForEvents(long sleepTime, AtomicBoolean condition, long timeout)
            throws InterruptedException {
        long currentWaitTime = 0;
        long startTime = System.currentTimeMillis();
        while (!condition.get() && (currentWaitTime <= timeout)) {
            Thread.sleep(sleepTime);
            currentWaitTime = System.currentTimeMillis() - startTime;
        }
    }
Helper class ot be used by siddhi tests. Any extension can utilize methods in here
modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiTestHelper.java