From f877a24eaa1fdfd15568e750adeea0571d97fd01 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 24 Jul 2024 23:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91PAY=EF=BC=9A=E7=A7=BB=E9=99=A4=20PayClient=20=E7=BC=93?= =?UTF-8?q?=E5=AD=98=EF=BC=8C=E5=87=8F=E5=B0=91=E5=A4=8D=E6=9D=82=E6=80=A7?= =?UTF-8?q?=EF=BC=8C=E6=80=A7=E8=83=BD=E8=B6=B3=E5=A4=9F=EF=BC=88=E9=9D=9E?= =?UTF-8?q?=E9=AB=98=E9=A2=91=E8=AF=BB=E5=8F=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/service/channel/PayChannelServiceTest.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java index 64ad3c482..229e71795 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java @@ -60,8 +60,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = channelMapper.selectById(channelId); assertPojoEquals(reqVO, channel, "config"); assertPojoEquals(config, channel.getConfig()); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(channelId)); } @Test @@ -102,8 +100,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = channelMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, channel, "config"); assertPojoEquals(config, channel.getConfig()); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(channel.getId())); } @Test @@ -134,8 +130,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { channelService.deleteChannel(id); // 校验数据不存在了 assertNull(channelMapper.selectById(id)); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(id)); } @Test @@ -306,20 +300,20 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = randomPojo(PayChannelDO.class, o -> { o.setCode(PayChannelEnum.ALIPAY_APP.getCode()); o.setConfig(randomAlipayPayClientConfig()); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); }); channelMapper.insert(channel); // mock 参数 Long id = channel.getId(); // mock 方法 PayClient mockClient = mock(PayClient.class); - when(payClientFactory.getPayClient(eq(id))).thenReturn(mockClient); + when(payClientFactory.createOrUpdatePayClient(eq(id), eq(channel.getCode()), eq(channel.getConfig()))) + .thenReturn(mockClient); // 调用 PayClient client = channelService.getPayClient(id); // 断言 assertSame(client, mockClient); - verify(payClientFactory).createOrUpdatePayClient(eq(id), eq(channel.getCode()), - eq(channel.getConfig())); } public WxPayClientConfig randomWxPayClientConfig() {