Skip to content

Instantly share code, notes, and snippets.

@dherges
Created September 25, 2016 12:52
Show Gist options
  • Save dherges/c6e66c3842551b2c3b005ef4711b7377 to your computer and use it in GitHub Desktop.
Save dherges/c6e66c3842551b2c3b005ef4711b7377 to your computer and use it in GitHub Desktop.
ok-testing-reloaded-medium
public class FakeTweetsDb extends TweetsDb {
public List<Tweet> fetchTweets(long id, int count) {
return IntStream.range(0, 100)
.mapToObj((i) -> {
final Tweet tweet = new Tweet();
tweet.id = id + i;
tweet.text = String.format("Mocked retweet of %s", id);
tweet.favorited = false;
tweet.user = new User();
tweet.user.name = "Maria Moccachino";
return tweet;
})
.collect(Collectors.toList());
}
}
public class TestApplicationContainer
extends ProductiveApplicationContainer
implements MyTwitterApplicationContainer {
@Override
public TweetsDb tweetsDb() {
return new FakeTweetsDb();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment