@Test public void testNavigationPagesOnly() { String pageTitle = "Page 1"; String pageURL = "/page1"; boolean active = true; NavigationItem item = mock(NavigationItem.class); when(item.getTitle()).thenReturn(pageTitle); when(item.getURL()).thenReturn(pageURL); when(item.isActive()).thenReturn(active); navigationItems.add(item); List<com.adobe.cq.commerce.core.components.models.navigation.NavigationItem> items = navigation.getItems(); Assert.assertEquals(1, items.size()); com.adobe.cq.commerce.core.components.models.navigation.NavigationItem navigationItem = items.get(0); Assert.assertEquals(pageTitle, navigationItem.getTitle()); Assert.assertEquals(pageURL, navigationItem.getURL()); Assert.assertEquals(active, navigationItem.isActive()); Navigation activeNavigation = navigationModel.getActiveNavigation(); Assert.assertEquals(navigation, activeNavigation); List<Navigation> navigationList = navigationModel.getNavigationList(); Assert.assertEquals(1, navigationList.size()); Assert.assertEquals(navigation, navigationList.get(0)); }
@Override public List<NavigationItem> getItems() { if (items == null) { items = new ArrayList<>(); PageManager pageManager = currentPage.getPageManager(); for (com.adobe.cq.wcm.core.components.models.NavigationItem wcmItem : wcmNavigation.getItems()) { addItems(pageManager, null, wcmItem, this.items); } } return items; }
NavigationImpl implements Navigation { @Override public List<NavigationItem> getItems() { if (items == null) { items = new ArrayList<>(); PageManager pageManager = currentPage.getPageManager(); for (com.adobe.cq.wcm.core.components.models.NavigationItem wcmItem : wcmNavigation.getItems()) { addItems(pageManager, null, wcmItem, this.items); } } return items; } }
NavigationImpl implements Navigation { @Override public List<NavigationItem> getItems() { if (items == null) { items = new ArrayList<>(); PageManager pageManager = currentPage.getPageManager(); for (com.adobe.cq.wcm.core.components.models.NavigationItem wcmItem : wcmNavigation.getItems()) { addItems(pageManager, null, wcmItem, this.items); } } return items; }  }
NavigationImpl implements Navigation { @Override public List<NavigationItem> getItems() { if (items == null) { items = new ArrayList<>(); PageManager pageManager = currentPage.getPageManager(); for (com.adobe.cq.wcm.core.components.models.NavigationItem wcmItem : wcmNavigation.getItems()) { addItems(pageManager, null, wcmItem, this.items); } } return items; }  @Override List<NavigationItem> getItems(); @Override String getId(); @Override String getParentId(); }
NavigationImpl implements Navigation { @Override public List<NavigationItem> getItems() { if (items == null) { items = new ArrayList<>(); PageManager pageManager = currentPage.getPageManager(); for (com.adobe.cq.wcm.core.components.models.NavigationItem wcmItem : wcmNavigation.getItems()) { addItems(pageManager, null, wcmItem, this.items); } } return items; }  @Override List<NavigationItem> getItems(); @Override String getId(); @Override String getParentId();  }