SketchClearer implements SketchClearListener { @Override public void onSketchCleared() { if (zenSketch.isSetup()) { zenSketch.clear(); } } SketchClearer(ZenSketch zenSketch, ZenSketchView zenSketchView); static SketchClearer newInstance(ZenSketchView zenSketchView); void clearSketch(); @Override void onSketchCleared();  }
@Test public void testOnSketchClearedClearsZenSketchIfSetUp() { given(zenSketch.isSetup()).willReturn(true); sketchClearer.onSketchCleared(); verify(zenSketch).clear(); }
@Test public void testOnSketchClearedDoesNotClearsZenSketchIfNotSetUp() { given(zenSketch.isSetup()).willReturn(false); sketchClearer.onSketchCleared(); verify(zenSketch, never()).clear(); }