EventDAO { @SqlQuery("select events.* from events join follow where follow.follower_id = :uid and events.user_id = follow.followee_id order by date limit 100") abstract public List<Event> homepageEvents(@Bind("uid") Long userId);  @SqlQuery("select events.* from events join follow where follow.follower_id = :uid and events.user_id = follow.followee_id order by date limit 100") abstract List<Event> homepageEvents(@Bind("uid") Long userId); void createEvent(Event event);  }
@Test public void testHomepageEvents() throws Exception { List<Event> evs = dao.homepageEvents(1l); assertThat(evs.size()).isEqualTo(0); dao.createEvent(evt); Thread.sleep(1000); dao.createEvent(evt); evs = dao.homepageEvents(1l); assertThat(evs.size()).isEqualTo(2); assertThat(evs.get(1).getId()).isGreaterThan(evs.get(0).getId()); }