### Question:
TransactionalBannerService extends AbstractTransactionalEntityService<Banner, BannerDao> implements BannerService { @Override public Map<String, Banner> getAllBanners() { Collection<Banner> allBanners = getDao().getAll(); Map<String, Banner> positionAndBannerMap = new HashMap<String, Banner>(); for (Banner banner : allBanners) { BannerPosition positionOnPage = banner.getPositionOnPage(); positionAndBannerMap.put(ObjectUtils.toString(positionOnPage), banner); } return positionAndBannerMap; } TransactionalBannerService(BannerDao bannerDao); @Override @PreAuthorize("hasPermission(#forumComponent.id, 'COMPONENT', 'GeneralPermission.ADMIN')") void uploadBanner(Banner uploadedBanner, Component forumComponent); @Override Map<String, Banner> getAllBanners();  }### Answer:
@Test public void bannersShouldBeFoundFromRepository() { Banner topBanner = new Banner(BannerPosition.TOP, "TOP"); Banner bottomBanner = new Banner(BannerPosition.BOTTOM, "BOTTOM"); List<Banner> banners = Arrays.asList(topBanner, bottomBanner); when(bannerDao.getAll()).thenReturn(banners); Map<String, Banner> positionToBannerMap = bannerService.getAllBanners(); assertEquals(positionToBannerMap.get(BannerPosition.TOP.toString()), topBanner); assertEquals(positionToBannerMap.get(BannerPosition.BOTTOM.toString()), bottomBanner); }