PlotDataManager implements AbstractPlotDataManager { boolean scrunchProtect(long time) { if (plot.getTimeAxisSubsequentSetting() == TimeAxisSubsequentBoundsSetting.SCRUNCH) { return time <= plot.getMinTime(); } else { return false; } } PlotDataManager(PlotterPlot thePlot); @Override void addDataSet(String dataSetName, Color plottingColor); @Override void addData(String feed, SortedMap<Long, Double> points); void resizeAndReloadPlotBuffer(); @Override void informUpdateCacheDataStreamStarted(); void informResizeEvent(); @Override PlotDataSeries getNamedDataSeries(String name); void setDataSeries(Map<String, PlotDataSeries> dataSeries); Map<String, PlotDataSeries> getDataSeries(); void setPlot(PlotterPlot plot); AbstractPlottingPackage getPlot();  }
@Test public void testScrunchProtect() { GregorianCalendar before = new GregorianCalendar(); GregorianCalendar start = new GregorianCalendar(); GregorianCalendar end = new GregorianCalendar(); end.add(Calendar.HOUR, 1); before.add(Calendar.HOUR, -1); PlotSettings settings = new PlotSettings(); settings.setMinTime(start.getTimeInMillis()); settings.setMaxTime(end.getTimeInMillis()); PlotAbstraction plot = new PlotView.Builder(PlotterPlot.class). plotSettings(settings). build(); PlotterPlot testPlot = (PlotterPlot) plot.returnPlottingPackage(); Assert.assertFalse(((PlotDataManager)testPlot.getPlotDataManager()).scrunchProtect(end.getTimeInMillis())); Assert.assertFalse(((PlotDataManager)testPlot.getPlotDataManager()).scrunchProtect(before.getTimeInMillis())); settings = new PlotSettings(); settings.setMinTime(start.getTimeInMillis()); settings.setMaxTime(end.getTimeInMillis()); settings.setTimeAxisSubsequentSetting(TimeAxisSubsequentBoundsSetting.SCRUNCH); plot = new PlotView.Builder(PlotterPlot.class). plotSettings(settings). build(); testPlot = (PlotterPlot) plot.returnPlottingPackage(); Assert.assertFalse(((PlotDataManager)testPlot.getPlotDataManager()).scrunchProtect(end.getTimeInMillis())); Assert.assertTrue(((PlotDataManager)testPlot.getPlotDataManager()).scrunchProtect(before.getTimeInMillis())); }