Commit d0290b88adfa19518aa2e55c906c30275ccf6d83
1 parent
aad85337
紧急修复 支付退款订单 service 单元测试bug
Showing
1 changed file
with
20 additions
and
19 deletions
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java
| ... | ... | @@ -11,7 +11,6 @@ import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; |
| 11 | 11 | import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; |
| 12 | 12 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 13 | 13 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 14 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 15 | 14 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 16 | 15 | import org.junit.jupiter.api.Test; |
| 17 | 16 | import org.springframework.context.annotation.Import; |
| ... | ... | @@ -19,10 +18,12 @@ import org.springframework.context.annotation.Import; |
| 19 | 18 | import javax.annotation.Resource; |
| 20 | 19 | import java.util.List; |
| 21 | 20 | |
| 21 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 22 | 22 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 23 | 23 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 24 | 24 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 25 | 25 | |
| 26 | + | |
| 26 | 27 | /** |
| 27 | 28 | * {@link PayRefundServiceImpl} 的单元测试类 |
| 28 | 29 | * |
| ... | ... | @@ -72,24 +73,24 @@ public class PayRefundServiceTest extends BaseDbUnitTest { |
| 72 | 73 | }); |
| 73 | 74 | refundMapper.insert(dbRefund); |
| 74 | 75 | // 测试 reqNo 不匹配 |
| 75 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setReqNo("RF1111112"))); | |
| 76 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setReqNo("RF1111112"))); | |
| 76 | 77 | // 测试 merchantId 不匹配 |
| 77 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantId(2L))); | |
| 78 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setMerchantId(2L))); | |
| 78 | 79 | // 测试 appId 不匹配 |
| 79 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setAppId(2L))); | |
| 80 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setAppId(2L))); | |
| 80 | 81 | // 测试 channelCode 不匹配 |
| 81 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); | |
| 82 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); | |
| 82 | 83 | // 测试 merchantRefundNo 不匹配 |
| 83 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); | |
| 84 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); | |
| 84 | 85 | // 测试 notifyStatus 不匹配 |
| 85 | 86 | refundMapper.insert( |
| 86 | - ObjectUtils.clone(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); | |
| 87 | + cloneIgnoreId(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); | |
| 87 | 88 | // 测试 status 不匹配 |
| 88 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); | |
| 89 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); | |
| 89 | 90 | // 测试 type 不匹配 |
| 90 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); | |
| 91 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); | |
| 91 | 92 | // 测试 createTime 不匹配 |
| 92 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> | |
| 93 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> | |
| 93 | 94 | o.setCreateTime(DateUtils.buildTime(2022, 1, 1, 10, 10, 10)))); |
| 94 | 95 | // 准备参数 |
| 95 | 96 | PayRefundPageReqVO reqVO = new PayRefundPageReqVO(); |
| ... | ... | @@ -147,24 +148,24 @@ public class PayRefundServiceTest extends BaseDbUnitTest { |
| 147 | 148 | }); |
| 148 | 149 | refundMapper.insert(dbRefund); |
| 149 | 150 | // 测试 reqNo 不匹配 |
| 150 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setReqNo("RF1111112"))); | |
| 151 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setReqNo("RF1111112"))); | |
| 151 | 152 | // 测试 merchantId 不匹配 |
| 152 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantId(2L))); | |
| 153 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setMerchantId(2L))); | |
| 153 | 154 | // 测试 appId 不匹配 |
| 154 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setAppId(2L))); | |
| 155 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setAppId(2L))); | |
| 155 | 156 | // 测试 channelCode 不匹配 |
| 156 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); | |
| 157 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); | |
| 157 | 158 | // 测试 merchantRefundNo 不匹配 |
| 158 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); | |
| 159 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); | |
| 159 | 160 | // 测试 notifyStatus 不匹配 |
| 160 | 161 | refundMapper.insert( |
| 161 | - ObjectUtils.clone(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); | |
| 162 | + cloneIgnoreId(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); | |
| 162 | 163 | // 测试 status 不匹配 |
| 163 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); | |
| 164 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); | |
| 164 | 165 | // 测试 type 不匹配 |
| 165 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); | |
| 166 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); | |
| 166 | 167 | // 测试 createTime 不匹配 |
| 167 | - refundMapper.insert(ObjectUtils.clone(dbRefund, o -> | |
| 168 | + refundMapper.insert(cloneIgnoreId(dbRefund, o -> | |
| 168 | 169 | o.setCreateTime(DateUtils.buildTime(2022, 1, 1, 10, 10, 10)))); |
| 169 | 170 | |
| 170 | 171 | // 准备参数 | ... | ... |