}
@Test
public void testComplexUpdate() throws Exception {
JTweet tw1 = createTweet(1L, "bla bli blu", "userA");
tw1.setCreatedAt(new MyDate().minusDays(2).toDate());
JTweet tw2 = createTweet(2L, "rt @usera: bla bli blu", "userB");
tw2.setCreatedAt(new MyDate().minusDays(2).plusMinutes(1).toDate());
JTweet tw3 = createTweet(3L, "rt @usera: bla bli blu", "userC");
tw3.setCreatedAt(new MyDate().minusDays(2).plusMinutes(1).toDate());
JTweet tw4 = createTweet(4L, "rt @usera: bla bli blu", "userD");
tw4.setCreatedAt(new MyDate().minusDays(2).plusMinutes(1).toDate());
twSearch.testUpdate(Arrays.asList(tw1, tw2, tw3, tw4));
assertEquals(1, twSearch.findByUserName("usera").getOwnTweets().size());
assertEquals(3, twSearch.findByTwitterId(1L).getReplyCount());
assertEquals(4, twSearch.getFeededTweets());
JTweet tw101 = createTweet(101L, "newtext two", "usera");
tw101.setCreatedAt(new Date());
JTweet tw102 = createTweet(102L, "newbla one", "userd");
tw102.setCreatedAt(new Date());
JTweet tw103 = createTweet(103L, "newbla two", "userd");
tw103.setCreatedAt(new Date());
JTweet tw104 = createTweet(104L, "rt @usera: newtext two", "userc");
tw104.setCreatedAt(new MyDate(tw101.getCreatedAt()).plusMinutes(1).toDate());
twSearch.setRemoveOlderThanDays(1);
twSearch.testUpdate(Arrays.asList(tw101, tw102, tw103, tw104));
assertEquals(4, twSearch.getFeededTweets());
assertEquals(4, twSearch.countAll());