ZoomEstimator extends Estimator { @Override public void run(XYPlot plot, XYSeriesBundle sf) { if(sf.getSeries() instanceof SampledXYSeries) { SampledXYSeries oxy = (SampledXYSeries) sf.getSeries(); final double factor = calculateZoom(oxy, plot.getBounds()); oxy.setZoomFactor(factor); } }  @Override void run(XYPlot plot, XYSeriesBundle sf);  }
@Test public void testCheck() throws Exception { ZoomEstimator estimator = spy(new ZoomEstimator()); SampledXYSeries series = spy(new SampledXYSeries(TestUtils .generateXYSeries("test series", 1000), 2, 100)); series.resample(); assertEquals(8d, series.getMaxZoomFactor()); XYSeriesBundle bundle = new XYSeriesBundle(series, null); when(xyPlot.getBounds()) .thenReturn(new RectRegion(0, 1000, 0, 1000)) .thenReturn(new RectRegion(0, 500, 0, 500)) .thenReturn(new RectRegion(0, 1, 0, 1)); estimator.run(xyPlot, bundle); estimator.run(xyPlot, bundle); estimator.run(xyPlot, bundle); verify(series).setZoomFactor(8); verify(series).setZoomFactor(4); verify(series).setZoomFactor(1); }