Search in sources :

Example 1 with UpSaleProductImpl

use of org.broadleafcommerce.core.catalog.domain.UpSaleProductImpl in project BroadleafCommerce by BroadleafCommerce.

the class ProductDaoTest method getRelatedUpSaleProduct.

private static RelatedProduct getRelatedUpSaleProduct(Product prod, Product prodToRelate, List<RelatedProduct> upSales) {
    RelatedProduct rp1 = new UpSaleProductImpl();
    rp1.setProduct(prod);
    rp1.setPromotionMessage("brand new coffee");
    rp1.setRelatedProduct(prodToRelate);
    upSales.add(rp1);
    return rp1;
}
Also used : UpSaleProductImpl(org.broadleafcommerce.core.catalog.domain.UpSaleProductImpl) RelatedProduct(org.broadleafcommerce.core.catalog.domain.RelatedProduct)

Example 2 with UpSaleProductImpl

use of org.broadleafcommerce.core.catalog.domain.UpSaleProductImpl in project BroadleafCommerce by BroadleafCommerce.

the class ProductDaoTest method testReadProductsWithUpSaleValues.

@Test(groups = "testReadProductsWithUpSaleValues", dependsOnGroups = "createUpSaleValues")
@Transactional
public void testReadProductsWithUpSaleValues() {
    Product result = productDao.readProductById(savedProducts.get(0).getId());
    List<RelatedProduct> related = result.getUpSaleProducts();
    assert (related != null);
    assert (!related.isEmpty());
    assert (related.size() == 2 || related.size() == 3);
    for (RelatedProduct rp : related) {
        assert (rp instanceof UpSaleProductImpl);
    }
}
Also used : UpSaleProductImpl(org.broadleafcommerce.core.catalog.domain.UpSaleProductImpl) Product(org.broadleafcommerce.core.catalog.domain.Product) RelatedProduct(org.broadleafcommerce.core.catalog.domain.RelatedProduct) RelatedProduct(org.broadleafcommerce.core.catalog.domain.RelatedProduct) Test(org.testng.annotations.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

RelatedProduct (org.broadleafcommerce.core.catalog.domain.RelatedProduct)2 UpSaleProductImpl (org.broadleafcommerce.core.catalog.domain.UpSaleProductImpl)2 Product (org.broadleafcommerce.core.catalog.domain.Product)1 Transactional (org.springframework.transaction.annotation.Transactional)1 Test (org.testng.annotations.Test)1