Exemplo n.º 1
0
 @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());
 }
Exemplo n.º 2
0
 @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());
 }
Exemplo n.º 3
0
 @Test(expected = IllegalArgumentException.class)
 public void shouldThrowExceptionIfResponseIsEmptyString() {
   String response = "";
   extractor.extract(response);
 }
Exemplo n.º 4
0
 @Test(expected = OAuthException.class)
 public void shouldThrowExceptionIfSecretIsAbsent() {
   String response = "oauth_token=hh5s93j4hdidpola&callback_confirmed=true";
   extractor.extract(response);
 }