修复部分单元测试报错的问题

pull/2/head
YunaiV 2022-11-13 21:08:15 +08:00
parent a543b8c67a
commit 12d045ea58
4 changed files with 22 additions and 22 deletions

View File

@ -124,7 +124,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest {
@SuppressWarnings("unchecked")
public void testDoGetSmsTemplate() throws Throwable {
// 准备参数
String apiTemplateId = randomString();
String apiTemplateId = String.valueOf(randomLongId());
// mock tpl 方法
TplApi tplApi = mock(TplApi.class);
when(client.tpl()).thenReturn(tplApi);

View File

@ -18,6 +18,7 @@ import javax.annotation.Resource;
import java.util.Date;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -118,7 +119,7 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType());
o.setCreateTime(buildTime(2022, 2, 2));
o.setCreateTime(buildLocalDateTime(2022, 2, 2));
});
couponTemplateMapper.insert(dbCouponTemplate);
// 测试 name 不匹配
@ -128,7 +129,7 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
// 测试 type 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setDiscountType(PromotionDiscountTypeEnum.PRICE.getType())));
// 测试 createTime 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildTime(2022, 1, 1))));
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildLocalDateTime(2022, 1, 1))));
// 准备参数
CouponTemplatePageReqVO reqVO = new CouponTemplatePageReqVO();
reqVO.setName("芋艿");

View File

@ -20,8 +20,7 @@ import java.time.Duration;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -183,7 +182,7 @@ public class DiscountActivityServiceImplTest extends BaseDbUnitTest {
DiscountActivityDO dbDiscountActivity = randomPojo(DiscountActivityDO.class, o -> { // 等会查询到
o.setName("芋艿");
o.setStatus(PromotionActivityStatusEnum.WAIT.getStatus());
o.setCreateTime(buildTime(2021, 1, 15));
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
});
discountActivityMapper.insert(dbDiscountActivity);
// 测试 name 不匹配
@ -191,7 +190,7 @@ public class DiscountActivityServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
discountActivityMapper.insert(cloneIgnoreId(dbDiscountActivity, o -> o.setStatus(PromotionActivityStatusEnum.END.getStatus())));
// 测试 createTime 不匹配
discountActivityMapper.insert(cloneIgnoreId(dbDiscountActivity, o -> o.setCreateTime(buildTime(2021, 2, 10))));
discountActivityMapper.insert(cloneIgnoreId(dbDiscountActivity, o -> o.setCreateTime(buildLocalDateTime(2021, 2, 10))));
// 准备参数
DiscountActivityPageReqVO reqVO = new DiscountActivityPageReqVO();
reqVO.setName("芋艿");

View File

@ -41,21 +41,21 @@
<artifactId>yudao-module-pay-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-promotion-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-product-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-trade-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-promotion-biz</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-product-biz</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-trade-biz</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- 数据报表 -->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->