### Question:
ProductCarouselImpl implements ProductCarousel { @Override public List<ProductListItem> getProducts() { if (productsRetriever == null) { return Collections.emptyList(); } List<ProductInterface> products = productsRetriever.fetchProducts(); Collections.sort(products, Comparator.comparing(item -> baseProductSkus.indexOf(item.getSku()))); List<ProductListItem> carouselProductList = new ArrayList<>(); if (!products.isEmpty()) { for (String combinedSku : productSkuList) { if (combinedSku.startsWith("/")) { combinedSku = StringUtils.substringAfterLast(combinedSku, "/"); } Pair<String, String> skus = SiteNavigation.toProductSkus(combinedSku); ProductInterface product = products.stream().filter(p -> p.getSku().equals(skus.getLeft())).findFirst().orElse(null); if (product == null) { continue; } String slug = product.getUrlKey(); if (skus.getRight() != null && product instanceof ConfigurableProduct) { SimpleProduct variant = findVariant((ConfigurableProduct) product, skus.getRight()); if (variant != null) { product = variant; } } try { Price price = new PriceImpl(product.getPriceRange(), locale); ProductImage thumbnail = product.getThumbnail(); carouselProductList.add(new ProductListItemImpl( skus.getLeft(), slug, product.getName(), price, thumbnail == null ? null : thumbnail.getUrl(), productPage, skus.getRight(), request, urlProvider)); } catch (Exception e) { LOGGER.error("Failed to instantiate product " + combinedSku, e); } } } return carouselProductList; }  @Override boolean isConfigured(); @Override List<ProductListItem> getProducts(); @Override AbstractProductsRetriever getProductsRetriever(); @Override String getTitleType();  }### Answer:
@Test public void getProducts() { Assert.assertEquals("h2", productCarousel.getTitleType()); List<ProductListItem> items = productCarousel.getProducts(); Assert.assertEquals(4, items.size()); List<String> productSkuList = Arrays.asList(productSkuArray) .stream() .map(s -> s.startsWith("/") ? StringUtils.substringAfterLast(s, "/") : s) .collect(Collectors.toList()); NumberFormat priceFormatter = NumberFormat.getCurrencyInstance(Locale.US); int idx = 0; for (String combinedSku : productSkuList) { Pair<String, String> skus = SiteNavigation.toProductSkus(combinedSku); ProductInterface product = products.stream().filter(p -> p.getSku().equals(skus.getLeft())).findFirst().orElse(null); if (product == null) { continue; } if (!items.stream().filter(i -> i.getSKU().equals(skus.getLeft())).findFirst().isPresent()) { continue; } ProductInterface productOrVariant = toProductOrVariant(product, skus); ProductListItem item = items.get(idx); Assert.assertEquals(productOrVariant.getName(), item.getTitle()); Assert.assertEquals(product.getSku(), item.getSKU()); Assert.assertEquals(product.getUrlKey(), item.getSlug()); Page productPage = context.pageManager().getPage(PRODUCT_PAGE); SiteNavigation siteNavigation = new SiteNavigation(context.request()); Assert.assertEquals(siteNavigation.toProductUrl(productPage, product.getUrlKey(), skus.getRight()), item.getURL()); Money amount = productOrVariant.getPriceRange().getMinimumPrice().getFinalPrice(); Assert.assertEquals(amount.getValue(), item.getPrice(), 0); Assert.assertEquals(amount.getCurrency().toString(), item.getCurrency()); priceFormatter.setCurrency(Currency.getInstance(amount.getCurrency().toString())); Assert.assertEquals(priceFormatter.format(amount.getValue()), item.getFormattedPrice()); ProductImage thumbnail = productOrVariant.getThumbnail(); if (thumbnail == null) { Assert.assertNull(item.getImageURL()); } else { Assert.assertEquals(thumbnail.getUrl(), item.getImageURL()); } idx++; } }