### Question:
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();  }### Answer:
@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); }
@Test public void testBuildPieDatasetRowsSeries() 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", "series", "rows"), null); ChartModel chartModel = getDataSource().getChartModel(); Dataset dataset = chartModel.getDataset(); Assert.assertTrue(dataset instanceof PieDataset); PieDataset pieDataset = (PieDataset) dataset; Assert.assertTrue(pieDataset.getKey(0).equals(" column 2 ")); Assert.assertTrue(pieDataset.getKey(1).equals(" column 3 ")); Assert.assertTrue(pieDataset.getKey(2).equals(" column 4")); Assert.assertTrue(pieDataset.getValue(0).intValue() == 12); Assert.assertTrue(pieDataset.getValue(1).intValue() == 13); Assert.assertTrue(pieDataset.getValue(2).intValue() == 14); }