@Test public void testBuildPieDataset() throws Exception { String content = "| column 1 | column 2 | column 3 | column 4\n" + "| row 1 | 12 | 13 | 14 \n" + "| row 2 | 22 | 23 | 24 \n"; setUpContentExpectation(content); getDataSource().buildDataset(content, map("type", "pie", "range", "B2-D3"), null); ChartModel chartModel = getDataSource().getChartModel(); Dataset dataset = chartModel.getDataset(); Assert.assertTrue(dataset instanceof PieDataset); PieDataset pieDataset = (PieDataset) dataset; Assert.assertTrue(pieDataset.getKey(0).equals(" row 1 ")); Assert.assertTrue(pieDataset.getKey(1).equals(" row 2 ")); Assert.assertTrue(pieDataset.getValue(0).intValue() == 12); Assert.assertTrue(pieDataset.getValue(1).intValue() == 22); }
@Override @SuppressWarnings("unchecked") public Dataset getDataset() { CategoryDataset dataset = (CategoryDataset) super.getDataset(); return new CategoryToPieDataset(dataset, TableOrder.BY_ROW, 0); }
TablePieDatasetBuilder extends TableCategoryDatasetBuilder { @Override @SuppressWarnings("unchecked") public Dataset getDataset() { CategoryDataset dataset = (CategoryDataset) super.getDataset(); return new CategoryToPieDataset(dataset, TableOrder.BY_ROW, 0); } }
TablePieDatasetBuilder extends TableCategoryDatasetBuilder { @Override @SuppressWarnings("unchecked") public Dataset getDataset() { CategoryDataset dataset = (CategoryDataset) super.getDataset(); return new CategoryToPieDataset(dataset, TableOrder.BY_ROW, 0); }  }
TablePieDatasetBuilder extends TableCategoryDatasetBuilder { @Override @SuppressWarnings("unchecked") public Dataset getDataset() { CategoryDataset dataset = (CategoryDataset) super.getDataset(); return new CategoryToPieDataset(dataset, TableOrder.BY_ROW, 0); }  @Override @SuppressWarnings("unchecked") Dataset getDataset(); }
TablePieDatasetBuilder extends TableCategoryDatasetBuilder { @Override @SuppressWarnings("unchecked") public Dataset getDataset() { CategoryDataset dataset = (CategoryDataset) super.getDataset(); return new CategoryToPieDataset(dataset, TableOrder.BY_ROW, 0); }  @Override @SuppressWarnings("unchecked") Dataset getDataset();  }