### Question:
BannerHibernateDao extends GenericDao<Banner> implements BannerDao { @Override @SuppressWarnings("unchecked") public Collection<Banner> getAll() { return session().getNamedQuery("getAll").list(); } BannerHibernateDao(SessionFactory sessionFactory); @Override Banner getByPosition(BannerPosition positionOnPage); @Override @SuppressWarnings("unchecked") Collection<Banner> getAll();  }### Answer:
@Test public void allBannersShouldBeReturnedWhenGetAllCalled() { Collection<Banner> persistedBanners = givenPersistedBanners(); Collection<Banner> foundBanners = bannerDao.getAll(); assertEquals(foundBanners.size(), persistedBanners.size(), "Incorrect collection of banners were returned from database."); assertEquals(foundBanners, persistedBanners, "Incorrect collection of banners were returned from database."); }
@Test public void emptyCollectionShouldBeReturnedWhenBannersDoNotExist() { Collection<Banner> foundBanners = bannerDao.getAll(); assertTrue(foundBanners.isEmpty(), "Incorrect banners were returned, because database doesn't contain any banner"); }