TweetRepository { void getUserSession(final Callback<TwitterSession> cb) { final TwitterSession session = userSessionManagers.getActiveSession(); if (session == null) { cb.failure(new TwitterAuthException("User authorization required")); } else { cb.success(new Result<>(session, null)); } } TweetRepository(Handler mainHandler, SessionManager<TwitterSession> userSessionManagers);   TweetRepository(Handler mainHandler, SessionManager<TwitterSession> userSessionManagers,
            TwitterCore twitterCore);   }
@Test public void testGetUserSession_withActiveUserSession() { final Callback<TwitterSession> cb = mock(Callback.class); tweetRepository.getUserSession(cb); verify(cb).success(any(Result.class)); }
@Test public void testGetUserSession_withNoActiveUserSession() { final Callback<TwitterSession> cb = mock(Callback.class); when(mockSessionManager.getActiveSession()).thenReturn(null); tweetRepository.getUserSession(cb); verify(cb).failure(any(TwitterAuthException.class)); }