@Test public void testProductSpecificPageOnLaunch() throws Exception { context.registerAdapter(Resource.class, Launch.class, (Function<Resource, Launch>) resource -> new MockLaunch(resource)); context.request().setContextPath(""); graphqlClient = Utils.setupGraphqlClientWithHttpResponseFrom("graphql/magento-graphql-product-breadcrumb-result.json"); String launchPage = "/content/launches/2020/09/14/mylaunch/content/venia/us/en/products/product-page/product-specific-page"; prepareModel(launchPage); context.request().setAttribute(WCMMode.class.getName(), WCMMode.EDIT); MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) context.request().getRequestPathInfo(); requestPathInfo.setSelectorString("tiberius-gym-tank"); breadcrumbModel = context.request().adaptTo(BreadcrumbImpl.class); List<NavigationItem> items = (List<NavigationItem>) breadcrumbModel.getItems(); assertThat(items.stream().map(i -> i.getTitle())).containsExactly("en", "Men", "Tops", "Tiberius Gym Tank"); for (NavigationItem item : items) { assertThat(item.getURL()).startsWith("/content/launches/2020/09/14/mylaunch/content/venia"); } NavigationItem product = items.get(3); assertThat(product.getURL()).isEqualTo(launchPage + ".tiberius-gym-tank.html"); assertThat(product.isActive()).isTrue(); }
@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();  }