BasicTimelineFilter implements TimelineFilter { boolean shouldFilterTweet(Tweet tweet) { if (tweet.user != null && containsMatchingScreenName(tweet.user.screenName)) { return true; } if (tweet.entities != null && (containsMatchingHashtag(tweet.entities.hashtags) || containsMatchingSymbol(tweet.entities.symbols) || containsMatchingUrl(tweet.entities.urls) || containsMatchingMention(tweet.entities.userMentions))) { return true; } return containsMatchingText(tweet); } BasicTimelineFilter(FilterValues filterValues);  BasicTimelineFilter(FilterValues filterValues, Locale locale); @Override List<Tweet> filter(List<Tweet> tweets); @Override int totalFilters();  }
@Test public void testShouldFilterTweet_withNoMatch() { assertFalse(basicTimelineFilter.shouldFilterTweet(TEST_TWEET_2)); }
@Test public void testShouldFilterTweet_withTextMatch() { assertTrue(basicTimelineFilter.shouldFilterTweet(TEST_TWEET_1)); }
@Test public void testShouldFilterTweet_withEntityMatch() { final UrlEntity entity = new UrlEntity("beevil.net", "http: final TweetEntities entities = new TweetEntities(Collections.singletonList(entity), null, null, null, null); final Tweet tweet = new TweetBuilder().setText("").setEntities(entities).build(); assertTrue(basicTimelineFilter.shouldFilterTweet(tweet)); }
@Test public void testShouldFilterTweet_withUserMatch() { final User user = new UserBuilder().setScreenName("EricFrohnhoefer").build(); final Tweet tweet = new TweetBuilder().setText("").setUser(user).build(); assertTrue(basicTimelineFilter.shouldFilterTweet(tweet)); }