AutoScheduleListener implements ReportProgressListener { private synchronized void autoSchedule( final ReportProgressEvent reportProgressEvent ) { if ( !scheduled && threshold > 0 && reportProgressEvent != null && reportProgressEvent.getMaximumRow() > threshold ) { pentahoAsyncExecutor.preSchedule( id, session ); scheduled = true; } } protected  AutoScheduleListener( final UUID id, final IPentahoSession session, final int threshold,
                                  final IPentahoAsyncExecutor pentahoAsyncExecutor ); @Override void reportProcessingStarted( final ReportProgressEvent reportProgressEvent ); @Override void reportProcessingUpdate( final ReportProgressEvent reportProgressEvent ); @Override void reportProcessingFinished( final ReportProgressEvent reportProgressEvent );  }
@Test public void testAutoSchedule() { final UUID id = UUID.randomUUID(); final IPentahoSession session = mock( IPentahoSession.class ); final IPentahoAsyncExecutor executor = mock( IPentahoAsyncExecutor.class ); final AutoScheduleListener listener = new AutoScheduleListener( id, session, threshold, executor ); listener.reportProcessingStarted( event ); listener.reportProcessingUpdate( event ); listener.reportProcessingFinished( event ); verify( executor, times( times ) ).preSchedule( id, session ); }