public void testTableXYDataset() {
XYSeries series1 = createSeries1();
XYSeries series2 = createSeries2();
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
dataset.addSeries(series1);
dataset.addSeries(series2);
// Test that there are 6 X points and some specific values
assertEquals(6, dataset.getItemCount());
assertEquals(6, dataset.getX(0, 5).intValue());
assertEquals(null, dataset.getY(0, 5));
assertEquals(6, dataset.getX(1, 5).intValue());
assertEquals(2, dataset.getY(1, 5).intValue());
// after adding a point to a series, check that there are now 7
// items in each series
series2.add(7, 2);
assertEquals(7, dataset.getItemCount());
assertEquals(null, dataset.getY(0, 6));
assertEquals(2, dataset.getY(1, 6).intValue());
// Remove series 1
dataset.removeSeries(series1);
// Test that there are still 7 X points
assertEquals(7, dataset.getItemCount());
// Remove series 2 and add new series
dataset.removeSeries(series2);
series1 = createSeries1();
dataset.addSeries(series1);
// Test that there are now 4 X points
assertEquals(4, dataset.getItemCount());
}