### Question:
SpamRuleHibernateDao extends GenericDao<SpamRule> implements SpamRuleDao { @Override public List<SpamRule> getAllRules() { return session().createCriteria(SpamRule.class).setCacheable(true).list(); } SpamRuleHibernateDao(SessionFactory sessionFactory); @Override List<SpamRule> getAllRules(); @Override List<SpamRule> getEnabledRules();  }### Answer:
@Test public void shouldReturnAllSavedRules() { List<SpamRule> expectedList = persistObjects(listOfRandomSpamRules(10)); List<SpamRule> actualList = dao.getAllRules(); assertEquals(actualList.size(), expectedList.size()); for (SpamRule expected : expectedList) { assertTrue(actualList.contains(expected)); } }