AccessTokenAuthenticator extends
        BaseRefreshableAuthenticator implements Authenticator { @Override public boolean isRefreshable() { return tokenStorage.getAccessToken() != null && tokenStorage.getAccessToken().getRefreshToken() != null; } AccessTokenAuthenticator(SessionConfiguration sessionConfiguration,
                                    AccessTokenStorage tokenStorage);   AccessTokenAuthenticator(SessionConfiguration sessionConfiguration,
                             AccessTokenStorage tokenStorage,
                             OAuth2Service auth2Service); @Override void signRequest(Request.Builder builder); @Override boolean isRefreshable(); @Override SessionConfiguration getSessionConfiguration(); AccessTokenStorage getTokenStorage();  }
@Test public void testIsRefreshable_noToken_returnsFalse() throws Exception { when(accessTokenStorage.getAccessToken()).thenReturn(null); assertFalse(authenticator.isRefreshable()); }
@Test public void testIsRefreshable_noRefreshToken_returnsFalse() throws Exception { when(accessTokenStorage.getAccessToken()).thenReturn(accessToken); when(accessToken.getRefreshToken()).thenReturn(null); assertFalse(authenticator.isRefreshable()); }
@Test public void testIsRefreshable_validToken_returnsTrue() throws Exception { when(accessTokenStorage.getAccessToken()).thenReturn(accessToken); when(accessToken.getRefreshToken()).thenReturn("refreshToken"); assertTrue(authenticator.isRefreshable()); }