@Test public void testCsvFast() throws Exception { URL url = getClass().getResource("BACKLOG-7181.prpt"); MasterReport report = (MasterReport) new ResourceManager().createDirectly(url, MasterReport.class).getResource(); org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile(); try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { FastCsvReportUtil.process(report, stream); final byte[] bytes = stream.toByteArray(); Assert.assertNotNull(bytes); Assert.assertTrue(bytes.length > 0); } }
@Test public void testCsvFastListener() throws Exception { URL url = getClass().getResource("BACKLOG-7181.prpt"); MasterReport report = (MasterReport) new ResourceManager().createDirectly(url, MasterReport.class).getResource(); org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile(); final ReportProgressListener mock = mock(ReportProgressListener.class); try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { FastCsvReportUtil.process(report, stream, mock); final byte[] bytes = stream.toByteArray(); Assert.assertNotNull(bytes); Assert.assertTrue(bytes.length > 0); } verify(mock, times(1)).reportProcessingStarted(any(ReportProgressEvent.class)); verify(mock, times(1)).reportProcessingFinished(any(ReportProgressEvent.class)); verify(mock, atLeastOnce()).reportProcessingUpdate(any(ReportProgressEvent.class)); try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { FastCsvReportUtil.process(new MasterReport(), stream, mock); } verify(mock, times(2)).reportProcessingStarted(any(ReportProgressEvent.class)); verify(mock, times(2)).reportProcessingFinished(any(ReportProgressEvent.class)); }