FixedTweetTimeline extends BaseTimeline implements Timeline<Tweet> { @Override public void next(Long minPosition, Callback<TimelineResult<Tweet>> cb) { final TimelineResult<Tweet> timelineResult = new TimelineResult<>(new TimelineCursor(tweets), tweets); cb.success(new Result(timelineResult, null)); } FixedTweetTimeline(List<Tweet> tweets); @Override void next(Long minPosition, Callback<TimelineResult<Tweet>> cb); @Override void previous(Long maxPosition, Callback<TimelineResult<Tweet>> cb);  }
@Test public void testNext_succeedsWithFixedTweets() { final FixedTweetTimeline timeline = new FixedTweetTimeline(fixedTweets); timeline.next(ANY_ID, new Callback<TimelineResult<Tweet>>() { @Override public void success(Result<TimelineResult<Tweet>> result) { assertEquals(fixedTweets, result.data.items); assertEquals((Long) TestFixtures.TEST_PHOTO_TWEET.getId(), result.data.timelineCursor.minPosition); assertEquals((Long) TestFixtures.TEST_TWEET.getId(), result.data.timelineCursor.maxPosition); assertNull(result.response); } @Override public void failure(TwitterException exception) { fail("Expected FixedTweetTimeline next to always succeed."); } }); }