public void testFidByUser() {
Article article = createArticle(createBlog());
User user1 = createUser();
User user2 = createUser();
for (int i = 0; i < 10; i++) {
Comment comment = new Comment();
comment.setContent("comment " + i);
comment.setCreationDate(new Date());
comment.setArticle(article);
comment.setUser(user1);
commentDao.merge(comment);
}
for (int i = 10; i < 30; i++) {
Comment comment = new Comment();
comment.setContent("comment " + i);
comment.setCreationDate(new Date());
comment.setArticle(article);
comment.setUser(user2);
commentDao.merge(comment);
}
List<Comment> user1Comments = commentDao.findByUser(user1);