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