@Test
public void testZoom() {

    xyPlot = spy(new InstrumentedXYPlot(getContext()));
    xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
    xyPlot.setRangeBoundaries(0, 100, BoundaryMode.FIXED);
    xyPlot.redraw();
    PanZoom panZoom = spy(new PanZoom(xyPlot, PanZoom.Pan.BOTH, PanZoom.Zoom.SCALE));
    // cap our pan/zoom boundaries:
    xyPlot.getOuterLimits().set(0, 100, 0, 100);
    panZoom.setFingersRect(new RectF(0, 0, 20, 20));
    InOrder inOrder = inOrder(xyPlot);
    inOrder.verify(xyPlot).setDomainBoundaries(0, 100, BoundaryMode.FIXED);
    // should result in a 2x zoom on domain centerpoint:
    panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 40, 40));
    inOrder.verify(xyPlot).setDomainBoundaries(25f, 75f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).setRangeBoundaries(25f, 75f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).redraw();
    // should result in another 2x zoom on domain centerpoint:
    panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 80, 80));
    inOrder.verify(xyPlot).setDomainBoundaries(37.5f, 62.5f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).setRangeBoundaries(37.5f, 62.5f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).redraw();
    // should zoom out and take us back to the original bounds:
    panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 20, 20));
    inOrder.verify(xyPlot).setDomainBoundaries(0f, 100f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).setRangeBoundaries(0f, 100f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).redraw();
    // zooming out past capped bounds should not result in any change:
    panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 1, 1));
    inOrder.verify(xyPlot).setDomainBoundaries(0f, 100f, BoundaryMode.FIXED);
    inOrder.verify(xyPlot).setRangeBoundaries(0f, 100f, BoundaryMode.FIXED);
    // TODO: if nothing changed, then why bother redrawing??
    inOrder.verify(xyPlot).redraw();
    // redraw should not be called again
    inOrder.verify(xyPlot, never()).redraw();
    // make sure no panning took place during these zoom ops:
    verify(panZoom, never()).pan(any(MotionEvent.class));
}