TwitterSessionVerifier implements SessionVerifier<TwitterSession> { public void verifySession(final TwitterSession session) { final AccountService accountService = accountServiceProvider.getAccountService(session); try { accountService.verifyCredentials(true, false, false).execute(); } catch (IOException | RuntimeException e) { } } TwitterSessionVerifier();   TwitterSessionVerifier(AccountServiceProvider accountServiceProvider); void verifySession(final TwitterSession session);  }
@Test public void testVerifySession() throws Exception { verifier.verifySession(session); verify(mockAccountService).verifyCredentials(true, false, false); }
@Test public void testVerifySession_catchesRetrofitExceptionsAndFinishesVerification() { doReturn(Calls.failure(new IOException())) .when(mockAccountService).verifyCredentials(true, false, false); verifier.verifySession(session); verify(mockAccountService).verifyCredentials(true, false, false); }