### Question:
LastReadPostHibernateDao extends GenericDao<LastReadPost> implements LastReadPostDao { @Override @SuppressWarnings("unchecked") public List<LastReadPost> getLastReadPostsInTopic(Topic topic) { return (List<LastReadPost>) session().getNamedQuery("getLastReadPostInTopicForAllUsers") .setParameter("topic", topic) .list(); } LastReadPostHibernateDao(SessionFactory sessionFactory); @Override @SuppressWarnings("unchecked") List<LastReadPost> getLastReadPostsInTopic(Topic topic); @Override LastReadPost getLastReadPost(JCUser forWho, Topic topic); @Override @SuppressWarnings("unchecked") List<LastReadPost> getLastReadPosts(JCUser forWho, List<Topic> sourceTopics); @Override void deleteLastReadPostsFor(JCUser user);  }### Answer:
@Test public void testListLastReadPostsForTopic() { LastReadPost post = PersistedObjectsFactory.getDefaultLastReadPost(); session.save(post); List<LastReadPost> lastReadPosts = lastReadPostDao.getLastReadPostsInTopic(post.getTopic()); assertTrue(lastReadPosts.size() == 1, "Result list has incorrect size"); assertEquals(lastReadPosts.get(0).getId(), post.getId(), "Results contains invalid data."); }