@Test public void testSafeDescription() { productModel = context.request().adaptTo(ProductImpl.class); String sampleString = "<strong>abc</strong>"; SimpleProduct product = mock(SimpleProduct.class, RETURNS_DEEP_STUBS); ComplexTextValue value = mock(ComplexTextValue.class, RETURNS_DEEP_STUBS); when(value.getHtml()).thenReturn(sampleString); when(product.getDescription()).thenReturn(value); Whitebox.setInternalState(productModel.getProductRetriever(), "product", product); Assert.assertEquals(sampleString, productModel.getDescription()); }
private String safeDescription(ProductInterface product) { ComplexTextValue description = product.getDescription(); if (description == null) { return null; } return xssApi.filterHTML(description.getHtml()); }
ProductImpl implements Product { private String safeDescription(ProductInterface product) { ComplexTextValue description = product.getDescription(); if (description == null) { return null; } return xssApi.filterHTML(description.getHtml()); } }
ProductImpl implements Product { private String safeDescription(ProductInterface product) { ComplexTextValue description = product.getDescription(); if (description == null) { return null; } return xssApi.filterHTML(description.getHtml()); }  }
ProductImpl implements Product { private String safeDescription(ProductInterface product) { ComplexTextValue description = product.getDescription(); if (description == null) { return null; } return xssApi.filterHTML(description.getHtml()); }  @Override Boolean getFound(); @Override String getName(); @Override String getDescription(); @Override String getSku(); @Override String getCurrency(); @Override Double getPrice(); @Override Price getPriceRange(); @Override Boolean getInStock(); @Override Boolean isConfigurable(); @Override Boolean isGroupedProduct(); @Override Boolean isVirtualProduct(); @Override Boolean isBundleProduct(); @Override String getVariantsJson(); @Override List<Variant> getVariants(); @Override List<GroupItem> getGroupedProductItems(); @Override List<Asset> getAssets(); @Override String getAssetsJson(); @Override List<VariantAttribute> getVariantAttributes(); @Override Boolean loadClientPrice(); @Override String getFormattedPrice(); @Override AbstractProductRetriever getProductRetriever(); }
ProductImpl implements Product { private String safeDescription(ProductInterface product) { ComplexTextValue description = product.getDescription(); if (description == null) { return null; } return xssApi.filterHTML(description.getHtml()); }  @Override Boolean getFound(); @Override String getName(); @Override String getDescription(); @Override String getSku(); @Override String getCurrency(); @Override Double getPrice(); @Override Price getPriceRange(); @Override Boolean getInStock(); @Override Boolean isConfigurable(); @Override Boolean isGroupedProduct(); @Override Boolean isVirtualProduct(); @Override Boolean isBundleProduct(); @Override String getVariantsJson(); @Override List<Variant> getVariants(); @Override List<GroupItem> getGroupedProductItems(); @Override List<Asset> getAssets(); @Override String getAssetsJson(); @Override List<VariantAttribute> getVariantAttributes(); @Override Boolean loadClientPrice(); @Override String getFormattedPrice(); @Override AbstractProductRetriever getProductRetriever();  }