/** * Test that a file was really generated, and that the image, when loaded, has the specified size. * @throws IOException possible exception when reading the image for validation */ public void testBarChartDemo() throws IOException { System.setProperty("java.awt.headless", "true"); String imageFilename = getOutputDirectory() + "barchart.png"; Demo demo = new Demo(); demo.createBarChart(imageFilename); File imagefile = new File(imageFilename); assertTrue(imagefile.exists()); BufferedImage image = ImageIO.read(imagefile); assertEquals(800, image.getWidth(null)); assertEquals(600, image.getHeight(null)); }