@Test public void testCanRetrieveUsersEvents() throws Exception { us.registerUser(user); FeedEvent fe = new FeedEvent(user); fs.addEvent(fe); UserLoggedIn ule = new UserLoggedIn(user); fs.addEvent(ule); List<FeedEvent> list = fs.listByUser(user, 0, 0); assertEquals(3, list.size()); for (FeedEvent feedEvent : list) { assertEquals(user, feedEvent.getUser()); } assertTrue(list.contains(new UserRegistered(user))); assertTrue(list.contains(new FeedEvent(user))); assertTrue(list.contains(new UserLoggedIn(user))); }
@Test public void testCanPersistFeedEvents() throws Exception { us.registerUser(user); FeedEvent e = new FeedEvent(user); assertFalse(e.isPersistent()); fs.addEvent(e); assertTrue(e.isPersistent()); }