OAuthApiV1 implements OAuthApi { public OAuthToken getRequestToken() throws Exception { List<EncodedPair> oauthPairs = oauth(variantProvider, consumerToken, methodType, requestTokenPath, EMPTY_HTTP_PAIRS, CALLBACK); Map<String,String> params = asMap(oauthPairs); return oauthInterface.getRequestToken( params.get("oauth_consumer_key"), params.get("oauth_signature_method"), params.get("oauth_timestamp"), params.get("oauth_nonce"), params.get("oauth_version"), params.get("oauth_callback"), params.get("oauth_signature") ); } OAuthApiV1(MethodType methodType, String oauthEndPoint, String requestTokenPath, String accessTokenPath, String refreshAccessTokenPath, OAuthInterface oauthInterface, OAuthToken consumerToken, VariantProvider variantProvider); OAuthToken getRequestToken(); OAuthToken getAccessToken(OAuthToken requestOAuthToken, String verifier); OAuthToken refreshAccessToken(OAuthToken token);  }
@Test public void shouldGetARequestTokenUsingGET() throws Exception { OAuthInterface mockOAuthInterface = mockGetOAuthInterface(); OAuthToken actual = newToTest(GET, mockOAuthInterface).getRequestToken(); assertEquals(mockOAuthToken, actual); verify(mockOAuthInterface).getRequestToken(consumerKey, signatureMethod, timestamp, nonce, version, "oob", "YZnn5PUIwRIvEaRAIYjQb5xIjho%3D"); }
@Test public void shouldGetARequestTokenUsingPOST() throws Exception { OAuthInterface mockOAuthInterface = mockPostOAuthInterface(); OAuthToken actual = newToTest(POST, mockOAuthInterface).getRequestToken(); assertEquals(mockOAuthToken, actual); verify(mockOAuthInterface).getRequestToken(consumerKey, signatureMethod, timestamp, nonce, version, "oob", "B4SlbjK%2FDDdvKtP1YQSH1CI61xs%3D"); }