ExcelChartSheetDefault implements ExcelChartSheet { @Override public ChartDataSource<?> getCategoryChartDataSource() { if (excelSheet.getRow(0) == null) { throw new IllegalStateException("It seems that we don't have any category in the excel file"); } return getChartDataSource(0); } ExcelChartSheetDefault(final Workbook workbook, final String excelSheetName); @Override void writeCell(final Object value, final Row row, final int column); @Override Row createRow(final int rowNumber); @Override Row createRow(); @Override void setColumnWidth(final int collNumber, final int size); @Override Chart createChartAndLegend(); @Override ChartDataSource<?> getCategoryChartDataSource(); @Override List<ChartDataSource<Number>> getValuesChartDataSource();  }
@Test public void getCategoryChartDataSource() throws Exception { final ExcelChartSheet excelChartSheet = new ExcelChartSheetDefault(workbook, ChartType.barcol.toString()); addCategories(excelChartSheet); ChartDataSource categoryChartDataSource = excelChartSheet.getCategoryChartDataSource(); Assert.assertEquals("check count of categories", 5, categoryChartDataSource.getPointCount()); Assert.assertEquals("check first category", "cat 1", categoryChartDataSource.getPointAt(0)); Assert.assertEquals("check last category", "cat 5", categoryChartDataSource.getPointAt(4)); }