@Test public void testProductPageWithCatalogPage() throws Exception { graphqlClient = Utils.setupGraphqlClientWithHttpResponseFrom("graphql/magento-graphql-product-breadcrumb-result.json"); prepareModel("/content/venia/us/en/products/product-page"); MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) context.request().getRequestPathInfo(); requestPathInfo.setSelectorString("tiberius-gym-tank"); Resource catalogPageResource = context.resourceResolver().getResource("/content/venia/us/en/products/jcr:content"); ModifiableValueMap properties = catalogPageResource.adaptTo(ModifiableValueMap.class); properties.replace("showMainCategories", false); breadcrumbModel = context.request().adaptTo(BreadcrumbImpl.class); Collection<NavigationItem> items = breadcrumbModel.getItems(); assertThat(items.stream().map(i -> i.getTitle())).containsExactly("en", "products", "Men", "Tops", "Tiberius Gym Tank"); }
@Override public Collection<NavigationItem> getItems() { if (!currentPage.getPath().startsWith("/content")) { return Collections.emptyList(); } if (items == null) { items = new ArrayList<>(); Collection<NavigationItem> pageItems = breadcrumb.getItems(); pageItems.forEach(item -> populateItems(item)); } return Collections.unmodifiableList(items); }
BreadcrumbImpl implements Breadcrumb { @Override public Collection<NavigationItem> getItems() { if (!currentPage.getPath().startsWith("/content")) { return Collections.emptyList(); } if (items == null) { items = new ArrayList<>(); Collection<NavigationItem> pageItems = breadcrumb.getItems(); pageItems.forEach(item -> populateItems(item)); } return Collections.unmodifiableList(items); } }
BreadcrumbImpl implements Breadcrumb { @Override public Collection<NavigationItem> getItems() { if (!currentPage.getPath().startsWith("/content")) { return Collections.emptyList(); } if (items == null) { items = new ArrayList<>(); Collection<NavigationItem> pageItems = breadcrumb.getItems(); pageItems.forEach(item -> populateItems(item)); } return Collections.unmodifiableList(items); }  }
BreadcrumbImpl implements Breadcrumb { @Override public Collection<NavigationItem> getItems() { if (!currentPage.getPath().startsWith("/content")) { return Collections.emptyList(); } if (items == null) { items = new ArrayList<>(); Collection<NavigationItem> pageItems = breadcrumb.getItems(); pageItems.forEach(item -> populateItems(item)); } return Collections.unmodifiableList(items); }  @Override Collection<NavigationItem> getItems(); @Override Comparator<CategoryInterface> getCategoryInterfaceComparator(); }
BreadcrumbImpl implements Breadcrumb { @Override public Collection<NavigationItem> getItems() { if (!currentPage.getPath().startsWith("/content")) { return Collections.emptyList(); } if (items == null) { items = new ArrayList<>(); Collection<NavigationItem> pageItems = breadcrumb.getItems(); pageItems.forEach(item -> populateItems(item)); } return Collections.unmodifiableList(items); }  @Override Collection<NavigationItem> getItems(); @Override Comparator<CategoryInterface> getCategoryInterfaceComparator();  }