Search in sources :

Example 1 with CrossSaleProductImpl

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

the class ProductDaoTest method getRelatedCrossProduct.

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

Example 2 with CrossSaleProductImpl

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

the class ProductDaoTest method testReadProductsWithCrossSaleValues.

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

Aggregations

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