OAuth1aService extends OAuthService { public void requestAccessToken(final Callback<OAuthResponse> callback, TwitterAuthToken requestToken, String verifier) { final String url = getAccessTokenUrl(); final String authHeader = new OAuth1aHeaders().getAuthorizationHeader(getTwitterCore() .getAuthConfig(), requestToken, null, "POST", url, null); api.getAccessToken(authHeader, verifier).enqueue(getCallbackWrapper(callback)); } OAuth1aService(TwitterCore twitterCore, TwitterApi api); void requestTempToken(final Callback<OAuthResponse> callback); String buildCallbackUrl(TwitterAuthConfig authConfig); void requestAccessToken(final Callback<OAuthResponse> callback,
            TwitterAuthToken requestToken, String verifier); String getAuthorizeUrl(TwitterAuthToken requestToken); static OAuthResponse parseAuthResponse(String response);  }
@Test public void testRequestAccessToken() { final TwitterAuthToken token = new TwitterAuthToken("token", "secret"); final String verifier = "verifier"; service.api = new MockOAuth1aService() { @Override public Call<ResponseBody> getAccessToken(@Header(OAuthConstants.HEADER_AUTHORIZATION) String auth, @Query(OAuthConstants.PARAM_VERIFIER) String innerVerifier) { assertEquals(verifier, innerVerifier); assertNotNull(auth); assertTrue(auth.contains(token.token)); return super.getAccessToken(auth, innerVerifier); } }; service.requestAccessToken(mock(Callback.class), token, verifier); }