@Test public void testMissingSelectorOnPublish() throws IOException { SlingBindings slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class.getName()); SightlyWCMMode wcmMode = mock(SightlyWCMMode.class); when(wcmMode.isDisabled()).thenReturn(true); slingBindings.put("wcmmode", wcmMode); MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) context.request().getRequestPathInfo(); requestPathInfo.setSelectorString(null); productListModel = context.request().adaptTo(ProductListImpl.class); Assert.assertTrue(productListModel.getProducts().isEmpty()); Mockito.verify(graphqlClient, never()).execute(any(), any(), any()); Mockito.verify(graphqlClient, never()).execute(any(), any(), any(), any()); }
@Nonnull @Override public Collection<ProductListItem> getProducts() { if (usePlaceholderData) { CategoryProducts categoryProducts = getCategory().getProducts(); ProductToProductListItemConverter converter = new ProductToProductListItemConverter(productPage, request, urlProvider); return categoryProducts.getItems().stream() .map(converter) .filter(Objects::nonNull) .collect(Collectors.toList()); } else { return getSearchResultsSet().getProductListItems(); } }
ProductListImpl extends ProductCollectionImpl implements ProductList { @Nonnull @Override public Collection<ProductListItem> getProducts() { if (usePlaceholderData) { CategoryProducts categoryProducts = getCategory().getProducts(); ProductToProductListItemConverter converter = new ProductToProductListItemConverter(productPage, request, urlProvider); return categoryProducts.getItems().stream() .map(converter) .filter(Objects::nonNull) .collect(Collectors.toList()); } else { return getSearchResultsSet().getProductListItems(); } } }
ProductListImpl extends ProductCollectionImpl implements ProductList { @Nonnull @Override public Collection<ProductListItem> getProducts() { if (usePlaceholderData) { CategoryProducts categoryProducts = getCategory().getProducts(); ProductToProductListItemConverter converter = new ProductToProductListItemConverter(productPage, request, urlProvider); return categoryProducts.getItems().stream() .map(converter) .filter(Objects::nonNull) .collect(Collectors.toList()); } else { return getSearchResultsSet().getProductListItems(); } }  }
ProductListImpl extends ProductCollectionImpl implements ProductList { @Nonnull @Override public Collection<ProductListItem> getProducts() { if (usePlaceholderData) { CategoryProducts categoryProducts = getCategory().getProducts(); ProductToProductListItemConverter converter = new ProductToProductListItemConverter(productPage, request, urlProvider); return categoryProducts.getItems().stream() .map(converter) .filter(Objects::nonNull) .collect(Collectors.toList()); } else { return getSearchResultsSet().getProductListItems(); } }  @Nullable @Override String getTitle(); @Override boolean showTitle(); @Override String getImage(); @Override boolean showImage(); @Nonnull @Override Collection<ProductListItem> getProducts(); @Nonnull @Override SearchResultsSet getSearchResultsSet(); @Override AbstractCategoryRetriever getCategoryRetriever(); }
ProductListImpl extends ProductCollectionImpl implements ProductList { @Nonnull @Override public Collection<ProductListItem> getProducts() { if (usePlaceholderData) { CategoryProducts categoryProducts = getCategory().getProducts(); ProductToProductListItemConverter converter = new ProductToProductListItemConverter(productPage, request, urlProvider); return categoryProducts.getItems().stream() .map(converter) .filter(Objects::nonNull) .collect(Collectors.toList()); } else { return getSearchResultsSet().getProductListItems(); } }  @Nullable @Override String getTitle(); @Override boolean showTitle(); @Override String getImage(); @Override boolean showImage(); @Nonnull @Override Collection<ProductListItem> getProducts(); @Nonnull @Override SearchResultsSet getSearchResultsSet(); @Override AbstractCategoryRetriever getCategoryRetriever();  }