public void exportPdf_defaults() throws UnknownViewTypeException, IOException { View view = new TableViewImpl(service, builder.buildViewNode(id, name, "table")); ViewExporter exporter = view.createExporter(); assertEquals(exporter.getId(), id); ViewExport result = exporter.exportPdf(null, null); server.assertRequestUris(URI_PDF); assertEquals(result.getViewId(), id); assertEquals(result.getExportType(), ViewExportType.PDF); InputStream stream = result.getInputStream(); assertEquals(stream.available(), 4236); }
public void exportPng_params() throws UnknownViewTypeException, IOException { View view = new TableViewImpl(service, builder.buildViewNode(id, name, "chart")); ViewExporter exporter = view.createExporter(); assertEquals(exporter.getId(), id); ViewExport result = exporter.exportPng(123, 456); server.assertRequestUris(URI_PNG); assertEquals(result.getViewId(), id); assertEquals(result.getExportType(), ViewExportType.PNG); BufferedImage image = ImageIO.read(result.getInputStream()); assertEquals(image.getWidth(), 56); assertEquals(image.getHeight(), 46); }