@Test
public void testOnRender() throws Exception {

    Segment segment = spy(new Segment("My Segment", 100));
    SegmentFormatter formatter = spy(
            new SegmentFormatter(Color.GREEN, Color.GREEN, Color.GREEN, Color.GREEN));
    PieRenderer pr = formatter.getRendererInstance(pieChart);
    PieRenderer renderer = spy(pr);
    doReturn(renderer.getClass()).when(formatter).getRendererClass();
    doReturn(renderer).when(formatter).getRendererInstance(any(PieChart.class));
    pieChart.addSegment(segment, formatter);
    renderer.onRender(canvas, plotArea, segment, formatter, renderStack);
}