### Question:
ChartUtils { public static BufferedImage getChartAsBufferedImage(String chartName) throws MarshalException, ValidationException, IOException, SQLException { BarChart chartConfig = getBarChartConfigByName(chartName); JFreeChart chart = getBarChart(chartName); ImageSize imageSize = chartConfig.getImageSize(); int hzPixels; int vtPixels; if (imageSize == null) { hzPixels = 400; vtPixels = 400; } else { hzPixels = imageSize.getHzSize().getPixels(); vtPixels = imageSize.getVtSize().getPixels(); } return chart.createBufferedImage(hzPixels, vtPixels); }  static JFreeChart getBarChart(String chartName); static void getBarChart(String chartName, OutputStream out); static void getBarChartPNG(String chartName, OutputStream out); static byte[] getBarChartAsPNGByteArray(String chartName); static BufferedImage getChartAsBufferedImage(String chartName); static BarChart getBarChartConfigByName(String chartName); static Iterator<BarChart> getChartCollectionIterator();  }### Answer:
@Test public void testGetChartAsBufferedImage() throws MarshalException, ValidationException, IOException, SQLException { BufferedImage bi = ChartUtils.getChartAsBufferedImage("sample-bar-chart"); assertEquals(300, bi.getHeight()); }