NavigationImpl extends AbstractComponentImpl implements Navigation { @Override public List<NavigationItem> getItems() { if (this.items == null) { this.items = Optional.ofNullable(this.getNavigationRoot()) .map(navigationRoot -> getRootItems(navigationRoot, structureStart)) .orElseGet(Stream::empty) .map(item -> this.createNavigationItem(item, getItems(item))) .collect(Collectors.toList()); } return Collections.unmodifiableList(items); }  @Override List<NavigationItem> getItems(); @Override @Nullable String getAccessibilityLabel(); @NotNull @Override String getExportedType(); static final String RESOURCE_TYPE; }
@Test void testNavigationNoRoot() { Navigation navigation = getNavigationUnderTest(NAV_COMPONENT_2); assertEquals(0, navigation.getItems().size(), "Didn't expect any navigation items."); Utils.testJSONExport(navigation, Utils.getTestExporterJSONPath(TEST_BASE, "navigation4")); }
@Test public void testNavigationRootMissingJCRContent() { Navigation navigation = getNavigationUnderTest(NAV_COMPONENT_11); Object[][] expectedPages = { {"/content/navigation-missing-jcr-content/navigation-1", 0, false, "/content/navigation-missing-jcr-content/navigation-1.html"}, {"/content/navigation-missing-jcr-content/navigation-2", 0, false, "/content/navigation-missing-jcr-content/navigation-2.html"} }; verifyNavigationItems(expectedPages, navigation.getItems()); }