@Test
public void testDrawSeries() throws Exception {

    // 100x100 plot space:
    plotArea = new RectF(0, 0, 99, 99);
    FastLineAndPointRenderer.Formatter formatter =
            new FastLineAndPointRenderer.Formatter(Color.RED, Color.RED, null);
    // create a series composed of 3 "segments"; series portions separated by null values:
    XYSeries series = new SimpleXYSeries(
            SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "some data", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    LineAndPointRenderer renderer = Mockito.spy(new LineAndPointRenderer(xyPlot));
    xyPlot.addSeries(series, formatter);
    xyPlot.calculateMinMaxVals();
    renderer.drawSeries(canvas, plotArea, series, formatter);
    PointF[] expectedPoints = new PointF[] {
            new PointF(0, 99),
            new PointF(11, 88),
            new PointF(22, 77),
            new PointF(33, 66),
            new PointF(44, 55),
            new PointF(55, 44),
            new PointF(66, 33),
            new PointF(77, 22),
            new PointF(88, 11),
            new PointF(99, 0)
    };
    ArgumentCaptor<List> capturedPoints= ArgumentCaptor.forClass(List.class);
    verify(renderer, times(1)).renderPoints(
            eq(canvas),
            eq(plotArea),
            eq(series),
            eq(0),
            eq(expectedPoints.length),
            capturedPoints.capture(),
            eq(formatter));
    List<PointF> pList = capturedPoints.getValue();
    // {0, 1}
    assertEquals(expectedPoints[0].x, pList.get(0).x);
    assertEquals(expectedPoints[0].y, pList.get(0).y);
    // {1, 2}
    assertEquals(expectedPoints[1].x, pList.get(1).x);
    assertEquals(expectedPoints[1].y, pList.get(1).y);
    // {2, 3}
    assertEquals(expectedPoints[2].x, pList.get(2).x);
    assertEquals(expectedPoints[2].y, pList.get(2).y);
    // {3, 4}
    assertEquals(expectedPoints[3].x, pList.get(3).x);
    assertEquals(expectedPoints[3].y, pList.get(3).y);
    // {4, 5}
    assertEquals(expectedPoints[4].x, pList.get(4).x);
    assertEquals(expectedPoints[4].y, pList.get(4).y);
    // {5, 6}
    assertEquals(expectedPoints[5].x, pList.get(5).x);
    assertEquals(expectedPoints[5].y, pList.get(5).y);
    // {6, 7}
    assertEquals(expectedPoints[6].x, pList.get(6).x);
    assertEquals(expectedPoints[6].y, pList.get(6).y);
    // {7, 8}
    assertEquals(expectedPoints[7].x, pList.get(7).x);
    assertEquals(expectedPoints[7].y, pList.get(7).y);
    // {8, 9}
    assertEquals(expectedPoints[8].x, pList.get(8).x);
    assertEquals(expectedPoints[8].y, pList.get(8).y);
    // {9, 10}
    assertEquals(expectedPoints[9].x, pList.get(9).x);
    assertEquals(expectedPoints[9].y, pList.get(9).y);
}