mall:code review 商品 spu 的后端代码

This commit is contained in:
YunaiV
2022-08-23 23:58:22 +08:00
parent edfe379848
commit c2fd24f597
8 changed files with 74 additions and 49 deletions

View File

@@ -41,7 +41,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
ProductSpuCreateReqVO reqVO = randomPojo(ProductSpuCreateReqVO.class);
// 调用
Long spuId = spuService.createSpu(reqVO);
Long spuId = spuService.createProductSpu(reqVO);
// 断言
assertNotNull(spuId);
// 校验记录的属性是否正确
@@ -60,7 +60,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
});
// 调用
spuService.updateSpu(reqVO);
spuService.updateProductSpu(reqVO);
// 校验是否更新正确
ProductSpuDO spu = ProductSpuMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, spu);
@@ -72,7 +72,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> spuService.updateSpu(reqVO), SPU_NOT_EXISTS);
assertServiceException(() -> spuService.updateProductSpu(reqVO), SPU_NOT_EXISTS);
}
@Test