Пример #1
0
 public void testOk() {
   Map<String, String[]> parameters = new HashMap<String, String[]>();
   String[] codes = new String[] {CODE};
   parameters.put(BaseOAuth20Provider.OAUTH_CODE, codes);
   OAuthCredential oauthCredential = provider.getCredential(null, parameters);
   assertNotNull(oauthCredential);
   assertEquals(CODE, oauthCredential.getVerifier());
 }
Пример #2
0
 public void testOAuthCredential() {
   OAuthCredential credential = new OAuthCredential(REQUEST_TOKEN, TOKEN, VERIFIER, TYPE);
   assertEquals(TOKEN, credential.getToken());
   assertEquals(VERIFIER, credential.getVerifier());
   assertEquals(TYPE, credential.getProviderType());
   Token requestToken = credential.getRequestToken();
   assertEquals(TOKEN, requestToken.getToken());
   assertEquals(SECRET, requestToken.getSecret());
   // test serialization
   byte[] bytes = CommonHelper.serialize(credential);
   OAuthCredential credential2 = (OAuthCredential) CommonHelper.unserialize(bytes);
   assertEquals(credential.getRequestToken().toString(), credential2.getRequestToken().toString());
   assertEquals(credential.getToken(), credential2.getToken());
   assertEquals(credential.getVerifier(), credential2.getVerifier());
   assertEquals(credential.getProviderType(), credential2.getProviderType());
 }