use of org.broadleafcommerce.core.catalog.domain.FeaturedProductImpl in project BroadleafCommerce by BroadleafCommerce.
the class CategoryDaoTest method testSetFeaturedProducts.
@Test(groups = { "testSetFeaturedProducts" }, dataProvider = "basicCategory", dataProviderClass = CategoryDaoDataProvider.class)
@Transactional
public void testSetFeaturedProducts(Category category) {
category = catalogService.saveCategory(category);
Sku sku = new SkuImpl();
sku.setDescription("This thing will change your life");
sku.setName("Test Product");
catalogService.saveSku(sku);
Product product = new ProductImpl();
product.setModel("KGX200");
product.setDefaultSku(sku);
product = catalogService.saveProduct(product);
FeaturedProduct featuredProduct = new FeaturedProductImpl();
featuredProduct.setCategory(category);
featuredProduct.setProduct(product);
featuredProduct.setPromotionMessage("BUY ME NOW!!!!");
List<FeaturedProduct> featuredProducts = new ArrayList<>();
featuredProducts.add(featuredProduct);
category.setFeaturedProducts(featuredProducts);
category = catalogService.saveCategory(category);
Category categoryTest = categoryDao.readCategoryById(category.getId());
FeaturedProduct featuredProductTest = categoryTest.getFeaturedProducts().get(0);
assert (featuredProductTest.getPromotionMessage() == "BUY ME NOW!!!!");
assert (featuredProductTest.getProduct().getModel().equals("KGX200"));
}
Aggregations