private SiteEntity createSiteFixture1() { SiteEntity siteEntity = new SiteEntity(); siteEntity.setKey(1); siteEntity.setLanguage(createLanguage("no", "Norwegian")); mi_forside = createMenuItem("1", "forside", null); mi_nyheter = createMenuItem("2", "nyheter", mi_forside); mi_innenriks = createMenuItem("3", "innenriks", mi_nyheter); siteEntity.setFirstPage(mi_forside); Map<CaseInsensitiveString, MenuItemEntity> topMenuItems = new LinkedHashMap<CaseInsensitiveString, MenuItemEntity>(); topMenuItems.put(new CaseInsensitiveString(mi_forside.getName()), mi_forside); siteEntity.setTopMenuItems(topMenuItems); return siteEntity; }
public void testGetMenuItemByPath() { SiteEntity site = createSiteFixture1(); MenuItemEntity actual; actual = site.resolveMenuItemByPath(new Path("")); assertEquals(mi_forside, actual); actual = site.resolveMenuItemByPath(new Path("/")); assertEquals(mi_forside, actual); actual = site.resolveMenuItemByPath(new Path("/forside/")); assertEquals(mi_forside, actual); actual = site.resolveMenuItemByPath(new Path("/forside/nyheter")); assertEquals(mi_nyheter, actual); actual = site.resolveMenuItemByPath(new Path("/forside/nyheter/innenriks/")); assertEquals(mi_innenriks, actual); }