PlotStatistics implements PlotListener { @Override public void onAfterDraw(Plot source, Canvas canvas) { lastLatency = System.currentTimeMillis() - lastStart; if(lastLatency < shortestRenderMs) { shortestRenderMs = lastLatency; } if(lastLatency > longestRenderMs) { longestRenderMs = lastLatency; } latencySum += lastLatency; latencySamples++; annotatePlot(source, canvas); } PlotStatistics(long updateDelayMs, boolean annotatePlotEnabled); void setAnnotatePlotEnabled(boolean enabled); @Override void onBeforeDraw(Plot source, Canvas canvas); @Override void onAfterDraw(Plot source, Canvas canvas); void setEnabled(boolean isEnabled);  }
@Test public void annotatePlot_annotates_ifEnabled() { ps.onAfterDraw(plot, canvas); verify(canvas).drawText(anyString(), anyFloat(), anyFloat(), any(Paint.class)); }