public void waitForInvocation(long msecWait,int numberOfNewEvents){
  long startTime=System.currentTimeMillis();
  while (true) {
    if ((System.currentTimeMillis() - startTime) > msecWait) {
      throw new RuntimeException("No events or less then the number of expected events received, expected " + numberOfNewEvents + " received "+ getNewDataListFlattened().length);
    }
    EventBean[] events=getNewDataListFlattened();
    if (events.length >= numberOfNewEvents) {
      return;
    }
    try {
      Thread.sleep(50);
    }
 catch (    InterruptedException e) {
      return;
    }
  }
}

public void waitForInvocation ( long msecWait , int numberOfNewEvents ) { long startTime = System . currentTimeMillis ( ) ; while ( true ) { if ( ( System . currentTimeMillis ( ) - startTime ) > msecWait ) { throw new RuntimeException ( "No events or less then the number of expected events received, expected " + numberOfNewEvents + " received " + getNewDataListFlattened ( ) . length ) ; } EventBean [ ] events = getNewDataListFlattened ( ) ; if ( events . length >= numberOfNewEvents ) { return ; } try { Thread . sleep ( 50 ) ; } catch ( InterruptedException e ) { return ; } } }
wait for the listener invocation for up to the given number of milliseconds .
