@Test public void shouldGetRequestedViewAndSetDataSourceAndWebContextInJasperView() throws Exception { whenNew(JasperReportsMultiFormatView.class).withNoArguments().thenReturn(jasperReportsView); when(objectInputStream.readObject()).thenReturn(jasperReport); when(byteArrayOutputStream.toByteArray()).thenReturn(reportByteData); Map<String, Object> parameterMap = new HashMap(); parameterMap.put("createdBy", 1l); JasperReportsMultiFormatView reportView = viewFactory.getJasperReportsView(template); assertThat(reportView, is(jasperReportsView)); verify(jasperReportsView).setJdbcDataSource(dataSource); verify(objectOutputStream).writeObject(jasperReport); }
public JasperReportsMultiFormatView getJasperReportsView(Template template) throws IOException, ClassNotFoundException, JRException { JasperReportsMultiFormatView jasperView = new JasperReportsMultiFormatView(); setExportParams(jasperView); setDataSourceAndURLAndApplicationContext(template, jasperView); return jasperView; }
JasperReportsViewFactory { public JasperReportsMultiFormatView getJasperReportsView(Template template) throws IOException, ClassNotFoundException, JRException { JasperReportsMultiFormatView jasperView = new JasperReportsMultiFormatView(); setExportParams(jasperView); setDataSourceAndURLAndApplicationContext(template, jasperView); return jasperView; } }
JasperReportsViewFactory { public JasperReportsMultiFormatView getJasperReportsView(Template template) throws IOException, ClassNotFoundException, JRException { JasperReportsMultiFormatView jasperView = new JasperReportsMultiFormatView(); setExportParams(jasperView); setDataSourceAndURLAndApplicationContext(template, jasperView); return jasperView; }  }
JasperReportsViewFactory { public JasperReportsMultiFormatView getJasperReportsView(Template template) throws IOException, ClassNotFoundException, JRException { JasperReportsMultiFormatView jasperView = new JasperReportsMultiFormatView(); setExportParams(jasperView); setDataSourceAndURLAndApplicationContext(template, jasperView); return jasperView; }  JasperReportsMultiFormatView getJasperReportsView(Template template); String getReportURLForReportData(Template template); }
JasperReportsViewFactory { public JasperReportsMultiFormatView getJasperReportsView(Template template) throws IOException, ClassNotFoundException, JRException { JasperReportsMultiFormatView jasperView = new JasperReportsMultiFormatView(); setExportParams(jasperView); setDataSourceAndURLAndApplicationContext(template, jasperView); return jasperView; }  JasperReportsMultiFormatView getJasperReportsView(Template template); String getReportURLForReportData(Template template);  }