コード例 #1
0
 @Test
 public void getHomeTimeline_paged_withSinceIdAndMaxId() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/home_timeline.json?count=100&since_id=1234567&max_id=7654321&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> timeline = twitter.timelineOperations().getHomeTimeline(100, 1234567, 7654321);
   assertTimelineTweets(timeline);
 }
コード例 #2
0
 @Test
 public void getUserTimeline_paged() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/user_timeline.json?count=15&user_id=2&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> timeline = twitter.timelineOperations().getUserTimeline(2, 15);
   assertTimelineTweets(timeline);
 }
コード例 #3
0
 @Test
 public void getRetweets_withCount() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/retweets/42.json?count=12&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> timeline = twitter.timelineOperations().getRetweets(42L, 12);
   assertTimelineTweets(timeline);
 }
コード例 #4
0
 @Test
 public void getMentions_paged_withSinceIdAndMaxId() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/mentions_timeline.json?count=50&since_id=112233&max_id=332211&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> mentions = twitter.timelineOperations().getMentions(50, 112233, 332211);
   assertTimelineTweets(mentions);
 }
コード例 #5
0
 @Test
 public void getMentions() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/mentions_timeline.json?count=20&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> mentions = twitter.timelineOperations().getMentions();
   assertTimelineTweets(mentions);
 }
コード例 #6
0
 @Test
 public void getUserTimeline_forUserId_paged_withSinceIdAndMaxId() {
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/statuses/user_timeline.json?count=24&since_id=112233&max_id=332211&user_id=12345&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("timeline"), APPLICATION_JSON));
   List<Tweet> timeline = twitter.timelineOperations().getUserTimeline(12345L, 24, 112233, 332211);
   assertTimelineTweets(timeline);
 }
コード例 #7
0
 @Test
 public void getFavorites_paged() {
   // Note: The documentation for /favorites.json doesn't list the count parameter, but it works
   // anyway.
   mockServer
       .expect(
           requestTo(
               "https://api.twitter.com/1.1/favorites/list.json?count=50&include_entities=true"))
       .andExpect(method(GET))
       .andRespond(withSuccess(jsonResource("favorite"), APPLICATION_JSON));
   List<Tweet> timeline = twitter.timelineOperations().getFavorites(50);
   assertTimelineTweets(timeline);
 }