Testing Portal Product Promotion List Retrieval in mall
This test suite validates the product promotion functionality in the mall-portal module, focusing on the retrieval and validation of promotional product data through the PortalProductDao interface.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
macrozheng/mall
mall-portal/src/test/java/com/macro/mall/portal/PortalProductDaoTests.java
package com.macro.mall.portal;
import com.macro.mall.portal.dao.PortalProductDao;
import com.macro.mall.portal.domain.PromotionProduct;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Created by macro on 2018/8/27.
* 前台商品查询逻辑单元测试
*/
@SpringBootTest
public class PortalProductDaoTests {
@Autowired
private PortalProductDao portalProductDao;
@Test
public void testGetPromotionProductList(){
List<Long> ids = new ArrayList<>();
ids.add(26L);
ids.add(27L);
ids.add(28L);
ids.add(29L);
List<PromotionProduct> promotionProductList = portalProductDao.getPromotionProductList(ids);
assertEquals(4,promotionProductList.size());
}
}