INT-1902 polished Twitter upgrade to make sure it is still backward compatible, also upgraded to the latest version 2.1.12

This commit is contained in:
Oleg Zhurakousky
2011-05-11 18:26:10 -04:00
parent 3f91ba3064
commit b3c427ed0c
5 changed files with 18 additions and 12 deletions

View File

@@ -61,12 +61,12 @@ public class Twitter4jTemplateTests {
}
@Test
public void testOauthConstructor() throws Exception{
template = new Twitter4jTemplate("a", "b", "c", "d");
template = new Twitter4jTemplate("a", "b", "1234-c", "d");
Twitter twitter = (Twitter) TestUtils.getPropertyValue(template, "twitter");
Authorization auth = twitter.getAuthorization();
assertTrue(twitter.getAuthorization() instanceof OAuthAuthorization);
AccessToken accessToken = ((OAuthAuthorization)auth).getOAuthAccessToken();
assertEquals("c", accessToken.getToken());
assertEquals("1234-c", accessToken.getToken());
assertEquals("d", accessToken.getTokenSecret());
}

View File

@@ -34,15 +34,13 @@ public class TwitterOperationExceptionTests {
@Test
public void test401(){
// will result in exception since a,b,c,d are invalid credentials
Twitter4jTemplate template = new Twitter4jTemplate("a", "b", "c", "d");
Twitter4jTemplate template = new Twitter4jTemplate("a", "b", "1234-c", "d");
try {
template.getProfileId();
fail();
} catch (Exception e) {
assertTrue(e instanceof TwitterOperationException);
assertEquals(401, ((TwitterOperationException)e).getTwitterStatusCode());
assertTrue(e.getMessage().contains("401:Authentication credentials were missing or incorrect"));
System.out.println(e.getMessage());
}
}
@Test