EventTracker { void trackActivity(Activity activity) { if(shouldTrack(activity)) { String activityName = activity.getClass().getSimpleName(); trackEvent(activity, activityName); } } EventTracker(Context context, List<EventTrackingService> services, boolean wifiOnly); void start();  }
@Test public void testTrackActivity() { EventTracker eventTracker = mock(EventTracker.class); Activity mockActivity = mock(Activity.class); doCallRealMethod().when(eventTracker).trackActivity(any(Activity.class)); when(eventTracker.shouldTrack(eq(mockActivity))).thenReturn(true); eventTracker.trackActivity(mockActivity); verify(eventTracker).trackEvent(eq(mockActivity), anyString()); }