FoamMain { void stop() { if(eventTracker != null) { eventTracker.stop(); } if(customExceptionHandler != null) { customExceptionHandler.stop(); } if(logListener != null) { logListener.stop(); } } FoamMain(Context context);   }
@Test public void testStop(){ FoamMain foamMain = new FoamMain(null); foamMain.stop(); EventTracker mockEventTracker = mock(EventTracker.class); CustomExceptionHandler mockCustomExceptionHandler = mock(CustomExceptionHandler.class); LogListener mockLogListener = mock(LogListener.class); foamMain.eventTracker = mockEventTracker; foamMain.customExceptionHandler = mockCustomExceptionHandler; foamMain.logListener = mockLogListener; foamMain.stop(); verify(mockEventTracker).stop(); verify(mockCustomExceptionHandler).stop(); verify(mockLogListener).stop(); }