List<JTweet> list = new ArrayList();
int counter = 0;
JUser user = new JUser("sakilamahipallb");
for (String tw : tweetsAsStr) {
counter++;
list.add(new JTweet(counter, tw, user).setCreatedAt(new Date(counter)));
}
execute(list);
counter = 0;
int spamCounter = 0;
for (JTweet tw : list) {
if (counter++ > 0) {
assertTrue("tweet:" + tw, tw.getQuality() < JTweet.QUAL_LOW);
if (tw.getQuality() < JTweet.QUAL_SPAM)
spamCounter++;
}
}
// a lot of those tweets are spam - not only bad!
assertTrue(spamCounter > 5);
user = new JUser("user2");
JTweet tw1 = new JTweet(1L, "E Grant Rd / N Swan Rd Accident no injury (Tue 3:24 PM) http://tinyurl.com/5hwubc", user).setCreatedAt(new Date(1));
JTweet tw2 = new JTweet(2L, "N Columbus Bl / E Grant Rd Accident no injury (Tue 3:26 PM) http://tinyurl.com/658t96", user).setCreatedAt(new Date(2));
execute(Arrays.asList(tw1, tw2));
// assertTrue("tweet:" + tw1, tw1.getQuality() < SolrTweet.QUAL_MAX);
assertTrue("tweet:" + tw1, tw1.getQuality() > JTweet.QUAL_SPAM);
assertTrue("tweet:" + tw2, tw2.getQuality() < JTweet.QUAL_MAX);
assertTrue("tweet:" + tw2, tw2.getQuality() > JTweet.QUAL_SPAM);
user = new JUser("user2");
tw1 = new JTweet(1L, "Werder Bremen verliert sein Heimspiel gegen Twente http://goo.gl/fb/fKFEi #werder #svw", user).setCreatedAt(new Date(1));
tw2 = new JTweet(2L, "Werder Bremen verliert gegen Twente Enschede http://goo.gl/fb/O8maL #werder #svw", user).setCreatedAt(new Date(2));
execute(Arrays.asList(tw1, tw2));
assertTrue("tweet:" + tw1, tw1.getQuality() == JTweet.QUAL_MAX);
assertTrue("tweet:" + tw2, tw2.getQuality() < JTweet.QUAL_MAX);
assertTrue("tweet:" + tw2, tw2.getQuality() > JTweet.QUAL_SPAM);
}