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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user