@Test public void shouldExtractTokenFromOAuthStandardResponse() { String response = "oauth_token=hh5s93j4hdidpola&oauth_token_secret=hdhd0244k9j7ao03"; Token extracted = extractor.extract(response); assertEquals("hh5s93j4hdidpola", extracted.getToken()); assertEquals("hdhd0244k9j7ao03", extracted.getSecret()); }
@Test public void shouldExtractTokenFromResponseWithCallbackConfirmed() { String response = "oauth_token=hh5s93j4hdidpola&oauth_token_secret=hdhd0244k9j7ao03&callback_confirmed=true"; Token extracted = extractor.extract(response); assertEquals("hh5s93j4hdidpola", extracted.getToken()); assertEquals("hdhd0244k9j7ao03", extracted.getSecret()); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionIfResponseIsEmptyString() { String response = ""; extractor.extract(response); }
@Test(expected = OAuthException.class) public void shouldThrowExceptionIfSecretIsAbsent() { String response = "oauth_token=hh5s93j4hdidpola&callback_confirmed=true"; extractor.extract(response); }