@Test public void testProductInterfaceConverted() { final ProductListItem result = converterUnderTest.apply(productInterface); verify(productPage).getLanguage(false); assertThat(result).isNotNull(); assertThat(result).isInstanceOf(ProductListItem.class); }
@Override public ProductListItem apply(final ProductInterface product) { try { boolean isStartPrice = product instanceof GroupedProduct; Price price = new PriceImpl(product.getPriceRange(), locale, isStartPrice); final ProductImage smallImage = product.getSmallImage(); ProductListItem productListItem = new ProductListItemImpl(product.getSku(), product.getUrlKey(), product.getName(), price, smallImage == null ? null : smallImage.getUrl(), productPage, null, request, urlProvider); return productListItem; } catch (Exception e) { LOGGER.error("Failed to instantiate product " + product.getSku(), e); return null; } }
ProductToProductListItemConverter implements Function<ProductInterface, ProductListItem> { @Override public ProductListItem apply(final ProductInterface product) { try { boolean isStartPrice = product instanceof GroupedProduct; Price price = new PriceImpl(product.getPriceRange(), locale, isStartPrice); final ProductImage smallImage = product.getSmallImage(); ProductListItem productListItem = new ProductListItemImpl(product.getSku(), product.getUrlKey(), product.getName(), price, smallImage == null ? null : smallImage.getUrl(), productPage, null, request, urlProvider); return productListItem; } catch (Exception e) { LOGGER.error("Failed to instantiate product " + product.getSku(), e); return null; } } }
ProductToProductListItemConverter implements Function<ProductInterface, ProductListItem> { @Override public ProductListItem apply(final ProductInterface product) { try { boolean isStartPrice = product instanceof GroupedProduct; Price price = new PriceImpl(product.getPriceRange(), locale, isStartPrice); final ProductImage smallImage = product.getSmallImage(); ProductListItem productListItem = new ProductListItemImpl(product.getSku(), product.getUrlKey(), product.getName(), price, smallImage == null ? null : smallImage.getUrl(), productPage, null, request, urlProvider); return productListItem; } catch (Exception e) { LOGGER.error("Failed to instantiate product " + product.getSku(), e); return null; } } ProductToProductListItemConverter(final Page productPage, final SlingHttpServletRequest request, final UrlProvider urlProvider); }
ProductToProductListItemConverter implements Function<ProductInterface, ProductListItem> { @Override public ProductListItem apply(final ProductInterface product) { try { boolean isStartPrice = product instanceof GroupedProduct; Price price = new PriceImpl(product.getPriceRange(), locale, isStartPrice); final ProductImage smallImage = product.getSmallImage(); ProductListItem productListItem = new ProductListItemImpl(product.getSku(), product.getUrlKey(), product.getName(), price, smallImage == null ? null : smallImage.getUrl(), productPage, null, request, urlProvider); return productListItem; } catch (Exception e) { LOGGER.error("Failed to instantiate product " + product.getSku(), e); return null; } } ProductToProductListItemConverter(final Page productPage, final SlingHttpServletRequest request, final UrlProvider urlProvider); @Override ProductListItem apply(final ProductInterface product); }
ProductToProductListItemConverter implements Function<ProductInterface, ProductListItem> { @Override public ProductListItem apply(final ProductInterface product) { try { boolean isStartPrice = product instanceof GroupedProduct; Price price = new PriceImpl(product.getPriceRange(), locale, isStartPrice); final ProductImage smallImage = product.getSmallImage(); ProductListItem productListItem = new ProductListItemImpl(product.getSku(), product.getUrlKey(), product.getName(), price, smallImage == null ? null : smallImage.getUrl(), productPage, null, request, urlProvider); return productListItem; } catch (Exception e) { LOGGER.error("Failed to instantiate product " + product.getSku(), e); return null; } } ProductToProductListItemConverter(final Page productPage, final SlingHttpServletRequest request, final UrlProvider urlProvider); @Override ProductListItem apply(final ProductInterface product);  }