@Test public void testConfigure_CSV() { final ReportFormat reportFormat = ReportFormat.CSV; final Map<String, String> map = new HashMap<>(); final String param1 = "param1"; final String param2 = "param2"; final String image1 = "image1"; final String image2 = "image2"; final String webpath1 = "webpath1"; final String webpath2 = "webpath2"; final String classpath1 = "classpath1"; final String classpath2 = "classpath2"; map.put(param1, image1); map.put(param2, image2); when(reportProps.getImageMapping()).thenReturn(Optional.of(map)); when(reportImageResolverSupplier.get()).thenReturn(reportImageResolver); when(reportImageResolver.webpath(image1)).thenReturn(webpath1); when(reportImageResolver.webpath(image2)).thenReturn(webpath2); when(reportImageResolver.classpath(image1)).thenReturn(classpath1); when(reportImageResolver.classpath(image2)).thenReturn(classpath2); final Map<String, Object> configure = sut.configure(reportProps, reportFormat, datasource); assertEquals(2, configure.size()); assertEquals(classpath1, configure.get(param1)); assertEquals(classpath2, configure.get(param2)); }
@Override public Map<String, Object> configure(ReportProps reportProps, ReportFormat reportFormat, JRDataSource datasource) { final Map<String, Object> parameters = newMap(); reportProps.getImageMapping().ifPresent( map -> map.forEach((param, name) -> { switch (reportFormat) { case HTML: parameters.put(param, reportImageResolverSupplier.get() .webpath(name)); break; default: parameters.put(param, reportImageResolverSupplier.get() .classpath(name)); break; } })); return parameters; }
SetImageMappingsTask implements ReportParameterConfigurerTask { @Override public Map<String, Object> configure(ReportProps reportProps, ReportFormat reportFormat, JRDataSource datasource) { final Map<String, Object> parameters = newMap(); reportProps.getImageMapping().ifPresent( map -> map.forEach((param, name) -> { switch (reportFormat) { case HTML: parameters.put(param, reportImageResolverSupplier.get() .webpath(name)); break; default: parameters.put(param, reportImageResolverSupplier.get() .classpath(name)); break; } })); return parameters; } }
SetImageMappingsTask implements ReportParameterConfigurerTask { @Override public Map<String, Object> configure(ReportProps reportProps, ReportFormat reportFormat, JRDataSource datasource) { final Map<String, Object> parameters = newMap(); reportProps.getImageMapping().ifPresent( map -> map.forEach((param, name) -> { switch (reportFormat) { case HTML: parameters.put(param, reportImageResolverSupplier.get() .webpath(name)); break; default: parameters.put(param, reportImageResolverSupplier.get() .classpath(name)); break; } })); return parameters; } SetImageMappingsTask(
			Supplier<ReportImageResolver> reportImageResolverSupplier); }
SetImageMappingsTask implements ReportParameterConfigurerTask { @Override public Map<String, Object> configure(ReportProps reportProps, ReportFormat reportFormat, JRDataSource datasource) { final Map<String, Object> parameters = newMap(); reportProps.getImageMapping().ifPresent( map -> map.forEach((param, name) -> { switch (reportFormat) { case HTML: parameters.put(param, reportImageResolverSupplier.get() .webpath(name)); break; default: parameters.put(param, reportImageResolverSupplier.get() .classpath(name)); break; } })); return parameters; } SetImageMappingsTask(
			Supplier<ReportImageResolver> reportImageResolverSupplier); @Override Map<String, Object> configure(ReportProps reportProps,
			ReportFormat reportFormat, JRDataSource datasource); static final SetImageMappingsTask newInstance(
			AbstractReportConfig reportConfig); }
SetImageMappingsTask implements ReportParameterConfigurerTask { @Override public Map<String, Object> configure(ReportProps reportProps, ReportFormat reportFormat, JRDataSource datasource) { final Map<String, Object> parameters = newMap(); reportProps.getImageMapping().ifPresent( map -> map.forEach((param, name) -> { switch (reportFormat) { case HTML: parameters.put(param, reportImageResolverSupplier.get() .webpath(name)); break; default: parameters.put(param, reportImageResolverSupplier.get() .classpath(name)); break; } })); return parameters; } SetImageMappingsTask(
			Supplier<ReportImageResolver> reportImageResolverSupplier); @Override Map<String, Object> configure(ReportProps reportProps,
			ReportFormat reportFormat, JRDataSource datasource); static final SetImageMappingsTask newInstance(
			AbstractReportConfig reportConfig);  }