CSVOutput implements ReportOutputHandler { public int generate( final MasterReport report, final int acceptedPage, final OutputStream outputStream, final int yieldRate ) throws ReportProcessingException, IOException, ContentIOException { final ReportProgressListener listener = ReportListenerThreadHolder.getListener(); CSVReportUtil.createCSV( report, outputStream, null, listener ); return 0; } CSVOutput(); Object getReportLock(); int paginate( MasterReport report, int yieldRate ); int generate( final MasterReport report,
                       final int acceptedPage,
                       final OutputStream outputStream,
                       final int yieldRate ); boolean supportsPagination(); void close();  }
@Test public void testGenerateListener() throws Exception { ClassicEngineBoot.getInstance().start(); csvOutput.generate( new MasterReport(), 1, new ByteArrayOutputStream(), 1 ); verify( listener, times( 1 ) ).reportProcessingStarted( any( ReportProgressEvent.class ) ); verify( listener, times( 1 ) ).reportProcessingFinished( any( ReportProgressEvent.class ) ); verify( listener, atLeastOnce() ).reportProcessingUpdate( any( ReportProgressEvent.class ) ); }
@Test public void testGenerate() throws Exception { ClassicEngineBoot.getInstance().start(); ReportListenerThreadHolder.clear(); csvOutput.generate( new MasterReport(), 1, new ByteArrayOutputStream(), 1 ); verify( listener, times( 0 ) ).reportProcessingStarted( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingFinished( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingUpdate( any( ReportProgressEvent.class ) ); }