@Test public void testIsNotConfigured() throws Exception { setUp(RelationType.CROSS_SELL_PRODUCTS, "graphql/magento-graphql-crosssellproducts-result.json", false); Assert.assertTrue(relatedProducts.getProducts().isEmpty()); }
@Override public List<ProductListItem> getProducts() { if (productsRetriever == null || !isConfigured()) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); if (products.isEmpty()) { return Collections.emptyList(); } List<ProductListItem> carouselProductList = new ArrayList<>(); for (ProductInterface product : products) { try { Price price = new PriceImpl(product.getPriceRange(), locale); carouselProductList.add(new ProductListItemImpl( product.getSku(), product.getUrlKey(), product.getName(), price, product.getThumbnail().getUrl(), productPage, null, request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + (product != null ? product.getSku() : null), e); } } return carouselProductList; }
RelatedProductsImpl implements ProductCarousel { @Override public List<ProductListItem> getProducts() { if (productsRetriever == null || !isConfigured()) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); if (products.isEmpty()) { return Collections.emptyList(); } List<ProductListItem> carouselProductList = new ArrayList<>(); for (ProductInterface product : products) { try { Price price = new PriceImpl(product.getPriceRange(), locale); carouselProductList.add(new ProductListItemImpl( product.getSku(), product.getUrlKey(), product.getName(), price, product.getThumbnail().getUrl(), productPage, null, request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + (product != null ? product.getSku() : null), e); } } return carouselProductList; } }
RelatedProductsImpl implements ProductCarousel { @Override public List<ProductListItem> getProducts() { if (productsRetriever == null || !isConfigured()) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); if (products.isEmpty()) { return Collections.emptyList(); } List<ProductListItem> carouselProductList = new ArrayList<>(); for (ProductInterface product : products) { try { Price price = new PriceImpl(product.getPriceRange(), locale); carouselProductList.add(new ProductListItemImpl( product.getSku(), product.getUrlKey(), product.getName(), price, product.getThumbnail().getUrl(), productPage, null, request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + (product != null ? product.getSku() : null), e); } } return carouselProductList; }  }
RelatedProductsImpl implements ProductCarousel { @Override public List<ProductListItem> getProducts() { if (productsRetriever == null || !isConfigured()) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); if (products.isEmpty()) { return Collections.emptyList(); } List<ProductListItem> carouselProductList = new ArrayList<>(); for (ProductInterface product : products) { try { Price price = new PriceImpl(product.getPriceRange(), locale); carouselProductList.add(new ProductListItemImpl( product.getSku(), product.getUrlKey(), product.getName(), price, product.getThumbnail().getUrl(), productPage, null, request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + (product != null ? product.getSku() : null), e); } } return carouselProductList; }  @Override boolean isConfigured(); @Override List<ProductListItem> getProducts(); @Override AbstractProductsRetriever getProductsRetriever(); @Override String getTitleType(); }
RelatedProductsImpl implements ProductCarousel { @Override public List<ProductListItem> getProducts() { if (productsRetriever == null || !isConfigured()) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); if (products.isEmpty()) { return Collections.emptyList(); } List<ProductListItem> carouselProductList = new ArrayList<>(); for (ProductInterface product : products) { try { Price price = new PriceImpl(product.getPriceRange(), locale); carouselProductList.add(new ProductListItemImpl( product.getSku(), product.getUrlKey(), product.getName(), price, product.getThumbnail().getUrl(), productPage, null, request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + (product != null ? product.getSku() : null), e); } } return carouselProductList; }  @Override boolean isConfigured(); @Override List<ProductListItem> getProducts(); @Override AbstractProductsRetriever getProductsRetriever(); @Override String getTitleType();  }