mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
商品spu和sku测试类调整
This commit is contained in:
parent
e314f4aaeb
commit
a86cbde090
@ -99,7 +99,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
|
||||
// 准备参数
|
||||
Integer id = 1;
|
||||
|
||||
// 调用, 并断言异常spu
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> skuService.deleteSku(id), SKU_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@ -108,25 +108,21 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
|
||||
public void testGetSkuPage() {
|
||||
// mock 数据
|
||||
SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到
|
||||
o.setCreateTime(null);
|
||||
o.setSpuId(null);
|
||||
o.setSkuStatus(null);
|
||||
o.setAttrs(null);
|
||||
o.setProperties(null);
|
||||
o.setPrice(null);
|
||||
o.setOriginalPrice(null);
|
||||
o.setCostPrice(null);
|
||||
o.setBarCode(null);
|
||||
o.setPicUrl(null);
|
||||
o.setStatus(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
skuMapper.insert(dbSku);
|
||||
// 测试 createTime 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null)));
|
||||
// 测试 spuId 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null)));
|
||||
// 测试 skuStatus 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSkuStatus(null)));
|
||||
// 测试 attrs 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setAttrs(null)));
|
||||
// 测试 properties 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null)));
|
||||
// 测试 price 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null)));
|
||||
// 测试 originalPrice 不匹配
|
||||
@ -137,18 +133,22 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null)));
|
||||
// 测试 picUrl 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null)));
|
||||
// 测试 status 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null)));
|
||||
// 测试 createTime 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SkuPageReqVO reqVO = new SkuPageReqVO();
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
reqVO.setSpuId(null);
|
||||
reqVO.setSkuStatus(null);
|
||||
reqVO.setAttrs(null);
|
||||
reqVO.setProperties(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setOriginalPrice(null);
|
||||
reqVO.setCostPrice(null);
|
||||
reqVO.setBarCode(null);
|
||||
reqVO.setPicUrl(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
|
||||
// 调用
|
||||
PageResult<SkuDO> pageResult = skuService.getSkuPage(reqVO);
|
||||
@ -163,25 +163,21 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
|
||||
public void testGetSkuList() {
|
||||
// mock 数据
|
||||
SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到
|
||||
o.setCreateTime(null);
|
||||
o.setSpuId(null);
|
||||
o.setSkuStatus(null);
|
||||
o.setAttrs(null);
|
||||
o.setProperties(null);
|
||||
o.setPrice(null);
|
||||
o.setOriginalPrice(null);
|
||||
o.setCostPrice(null);
|
||||
o.setBarCode(null);
|
||||
o.setPicUrl(null);
|
||||
o.setStatus(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
skuMapper.insert(dbSku);
|
||||
// 测试 createTime 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null)));
|
||||
// 测试 spuId 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null)));
|
||||
// 测试 skuStatus 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSkuStatus(null)));
|
||||
// 测试 attrs 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setAttrs(null)));
|
||||
// 测试 properties 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null)));
|
||||
// 测试 price 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null)));
|
||||
// 测试 originalPrice 不匹配
|
||||
@ -192,18 +188,22 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null)));
|
||||
// 测试 picUrl 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null)));
|
||||
// 测试 status 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null)));
|
||||
// 测试 createTime 不匹配
|
||||
skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SkuExportReqVO reqVO = new SkuExportReqVO();
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
reqVO.setSpuId(null);
|
||||
reqVO.setSkuStatus(null);
|
||||
reqVO.setAttrs(null);
|
||||
reqVO.setProperties(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setOriginalPrice(null);
|
||||
reqVO.setCostPrice(null);
|
||||
reqVO.setBarCode(null);
|
||||
reqVO.setPicUrl(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
|
||||
// 调用
|
||||
List<SkuDO> list = skuService.getSkuList(reqVO);
|
||||
|
@ -108,34 +108,27 @@ public class SpuServiceImplTest extends BaseDbUnitTest {
|
||||
public void testGetSpuPage() {
|
||||
// mock 数据
|
||||
SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到
|
||||
o.setCreateTime(null);
|
||||
o.setName(null);
|
||||
o.setVisible(null);
|
||||
o.setSellPoint(null);
|
||||
o.setDescription(null);
|
||||
o.setCid(null);
|
||||
o.setListPicUrl(null);
|
||||
o.setCategoryId(null);
|
||||
o.setPicUrls(null);
|
||||
o.setSort(null);
|
||||
o.setLikeCount(null);
|
||||
o.setPrice(null);
|
||||
o.setQuantity(null);
|
||||
o.setStatus(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
spuMapper.insert(dbSpu);
|
||||
// 测试 createTime 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null)));
|
||||
// 测试 name 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null)));
|
||||
// 测试 visible 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setVisible(null)));
|
||||
// 测试 sellPoint 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null)));
|
||||
// 测试 description 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null)));
|
||||
// 测试 cid 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCid(null)));
|
||||
// 测试 listPicUrl 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setListPicUrl(null)));
|
||||
// 测试 categoryId 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null)));
|
||||
// 测试 picUrls 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null)));
|
||||
// 测试 sort 不匹配
|
||||
@ -146,21 +139,24 @@ public class SpuServiceImplTest extends BaseDbUnitTest {
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null)));
|
||||
// 测试 quantity 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null)));
|
||||
// 测试 status 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null)));
|
||||
// 测试 createTime 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SpuPageReqVO reqVO = new SpuPageReqVO();
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setVisible(null);
|
||||
reqVO.setSellPoint(null);
|
||||
reqVO.setDescription(null);
|
||||
reqVO.setCid(null);
|
||||
reqVO.setListPicUrl(null);
|
||||
reqVO.setCategoryId(null);
|
||||
reqVO.setPicUrls(null);
|
||||
reqVO.setSort(null);
|
||||
reqVO.setLikeCount(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setQuantity(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
|
||||
// 调用
|
||||
PageResult<SpuDO> pageResult = spuService.getSpuPage(reqVO);
|
||||
@ -175,34 +171,27 @@ public class SpuServiceImplTest extends BaseDbUnitTest {
|
||||
public void testGetSpuList() {
|
||||
// mock 数据
|
||||
SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到
|
||||
o.setCreateTime(null);
|
||||
o.setName(null);
|
||||
o.setVisible(null);
|
||||
o.setSellPoint(null);
|
||||
o.setDescription(null);
|
||||
o.setCid(null);
|
||||
o.setListPicUrl(null);
|
||||
o.setCategoryId(null);
|
||||
o.setPicUrls(null);
|
||||
o.setSort(null);
|
||||
o.setLikeCount(null);
|
||||
o.setPrice(null);
|
||||
o.setQuantity(null);
|
||||
o.setStatus(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
spuMapper.insert(dbSpu);
|
||||
// 测试 createTime 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null)));
|
||||
// 测试 name 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null)));
|
||||
// 测试 visible 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setVisible(null)));
|
||||
// 测试 sellPoint 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null)));
|
||||
// 测试 description 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null)));
|
||||
// 测试 cid 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCid(null)));
|
||||
// 测试 listPicUrl 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setListPicUrl(null)));
|
||||
// 测试 categoryId 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null)));
|
||||
// 测试 picUrls 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null)));
|
||||
// 测试 sort 不匹配
|
||||
@ -213,21 +202,24 @@ public class SpuServiceImplTest extends BaseDbUnitTest {
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null)));
|
||||
// 测试 quantity 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null)));
|
||||
// 测试 status 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null)));
|
||||
// 测试 createTime 不匹配
|
||||
spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SpuExportReqVO reqVO = new SpuExportReqVO();
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setVisible(null);
|
||||
reqVO.setSellPoint(null);
|
||||
reqVO.setDescription(null);
|
||||
reqVO.setCid(null);
|
||||
reqVO.setListPicUrl(null);
|
||||
reqVO.setCategoryId(null);
|
||||
reqVO.setPicUrls(null);
|
||||
reqVO.setSort(null);
|
||||
reqVO.setLikeCount(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setQuantity(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setBeginCreateTime(null);
|
||||
reqVO.setEndCreateTime(null);
|
||||
|
||||
// 调用
|
||||
List<SpuDO> list = spuService.getSpuList(reqVO);
|
||||
|
Loading…
Reference in New Issue
Block a user