@Test
public void testCullPointsCache() throws Exception {

    LineAndPointFormatter formatter =
            new LineAndPointFormatter(0, 0, 0, null);
    // create a series composed of 3 "segments"; series portions separated by null values:
    SimpleXYSeries series = new SimpleXYSeries(
            SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "some data", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    xyPlot.addSeries(series, formatter);
    LineAndPointRenderer renderer = xyPlot.getRenderer(LineAndPointRenderer.class);
    assertEquals(0, renderer.pointsCaches.size());
    // should generate a new pointCache:
    renderer.getPointsCache(series);
    assertEquals(1, renderer.pointsCaches.size());
    // culling should not delete it since it is
    // registered in the series registry:
    renderer.getPointsCache(series);
    assertEquals(1, renderer.pointsCaches.size());
    renderer.cullPointsCache();
    assertEquals(1, renderer.pointsCaches.size());
    // unregister the series.  this time, culling should remove the series
    // from the points cache:
    xyPlot.removeSeries(series);
    renderer.cullPointsCache();
    assertEquals(0, renderer.pointsCaches.size());
}