SessionMonitor { public void monitorActivityLifecycle(ActivityLifecycleManager activityLifecycleManager) { activityLifecycleManager.registerCallbacks(new ActivityLifecycleManager.Callbacks() { @Override public void onActivityStarted(Activity activity) { triggerVerificationIfNecessary(); } }); } SessionMonitor(SessionManager<T> sessionManager, ExecutorService executorService,
            SessionVerifier<T> sessionVerifier);   SessionMonitor(SessionManager<T> sessionManager, SystemCurrentTimeProvider time,
            ExecutorService executorService, MonitorState monitorState, SessionVerifier
            sessionVerifier); void monitorActivityLifecycle(ActivityLifecycleManager activityLifecycleManager); void triggerVerificationIfNecessary();  }
@Test public void testMonitorActivityLifecycle_registersActivityLifecycleCallbacks() { final ActivityLifecycleManager mockActivityLifecycleManager = mock(ActivityLifecycleManager.class); sessionMonitor = new SessionMonitor<>(mockSessionManager, mockExecutorService, mockSessionVerifier); sessionMonitor.monitorActivityLifecycle(mockActivityLifecycleManager); verify(mockActivityLifecycleManager) .registerCallbacks(any(ActivityLifecycleManager.Callbacks.class)); }