AccessTokenAuthenticator extends
        BaseRefreshableAuthenticator implements Authenticator { AccessToken refreshToken(AccessToken auth2Token) throws IOException { AccessToken newToken = auth2Service.refresh(auth2Token.getRefreshToken(), sessionConfiguration.getClientId()) .execute().body(); tokenStorage.setAccessToken(newToken); return newToken; } 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 testRefreshToken() throws Exception { when(accessToken.getRefreshToken()).thenReturn("refresh"); when(config.getClientId()).thenReturn("clientId"); when(service.refresh(eq("refresh"), eq("clientId"))).thenReturn(serviceResult); when(serviceResult.execute()).thenReturn(retrofit2.Response.success(accessToken)); assertEquals(accessToken, authenticator.refreshToken(accessToken)); verify(accessTokenStorage).setAccessToken(accessToken); }