mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 11:40:05 +08:00
mall + pay:
1. 修复单元测试的报错
This commit is contained in:
parent
6aea461e8d
commit
3a24d05bdc
2
pom.xml
2
pom.xml
@ -20,7 +20,7 @@
|
|||||||
<!-- <module>yudao-module-bpm</module>-->
|
<!-- <module>yudao-module-bpm</module>-->
|
||||||
<!-- <module>yudao-module-report</module>-->
|
<!-- <module>yudao-module-report</module>-->
|
||||||
<!-- <module>yudao-module-mp</module>-->
|
<!-- <module>yudao-module-mp</module>-->
|
||||||
<module>yudao-module-mall</module>
|
<!-- <module>yudao-module-mall</module>-->
|
||||||
<!-- 示例项目 -->
|
<!-- 示例项目 -->
|
||||||
<module>yudao-example</module>
|
<module>yudao-example</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@ -8,7 +8,6 @@ import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration
|
|||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -41,7 +40,6 @@ public class BaseDbAndRedisUnitTest {
|
|||||||
|
|
||||||
// Redis 配置类
|
// Redis 配置类
|
||||||
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
||||||
RedisAutoConfiguration.class, // Spring Redis 自动配置类
|
|
||||||
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||||
RedissonAutoConfiguration.class, // Redisson 自动高配置类
|
RedissonAutoConfiguration.class, // Redisson 自动高配置类
|
||||||
})
|
})
|
||||||
|
@ -39,7 +39,7 @@ public class MemberAddressDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 地区编号
|
* 地区编号
|
||||||
*/
|
*/
|
||||||
private Integer areaId;
|
private Long areaId;
|
||||||
/**
|
/**
|
||||||
* 收件详细地址
|
* 收件详细地址
|
||||||
*/
|
*/
|
||||||
|
@ -23,9 +23,8 @@ CREATE TABLE IF NOT EXISTS "member_address" (
|
|||||||
"name" varchar(10) NOT NULL,
|
"name" varchar(10) NOT NULL,
|
||||||
"mobile" varchar(20) NOT NULL,
|
"mobile" varchar(20) NOT NULL,
|
||||||
"area_id" bigint(20) NOT NULL,
|
"area_id" bigint(20) NOT NULL,
|
||||||
"post_code" varchar(16) NOT NULL,
|
|
||||||
"detail_address" varchar(250) NOT NULL,
|
"detail_address" varchar(250) NOT NULL,
|
||||||
"defaulted" bit NOT NULL,
|
"default_status" bit NOT NULL,
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"creator" varchar(64) DEFAULT '',
|
"creator" varchar(64) DEFAULT '',
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
@ -20,9 +20,11 @@ import org.springframework.context.annotation.Import;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
@ -68,7 +70,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
|
|||||||
public void testRefreshLocalCache() {
|
public void testRefreshLocalCache() {
|
||||||
// mock 数据 01
|
// mock 数据 01
|
||||||
PayChannelDO dbChannel = randomPojo(PayChannelDO.class,
|
PayChannelDO dbChannel = randomPojo(PayChannelDO.class,
|
||||||
o -> o.setConfig(randomWxPayClientConfig()));
|
o -> o.setConfig(randomWxPayClientConfig()).setUpdateTime(addTime(Duration.ofMinutes(-2))));
|
||||||
channelMapper.insert(dbChannel);// @Sql: 先插入出一条存在的数据
|
channelMapper.insert(dbChannel);// @Sql: 先插入出一条存在的数据
|
||||||
channelService.initLocalCache();
|
channelService.initLocalCache();
|
||||||
// mock 数据 02
|
// mock 数据 02
|
||||||
|
@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS "pay_app" (
|
|||||||
"name" varchar(64) NOT NULL,
|
"name" varchar(64) NOT NULL,
|
||||||
"status" tinyint NOT NULL,
|
"status" tinyint NOT NULL,
|
||||||
"remark" varchar(255) DEFAULT NULL,
|
"remark" varchar(255) DEFAULT NULL,
|
||||||
`pay_notify_url` varchar(1024) NOT NULL,
|
`order_notify_url` varchar(1024) NOT NULL,
|
||||||
`refund_notify_url` varchar(1024) NOT NULL,
|
`refund_notify_url` varchar(1024) NOT NULL,
|
||||||
"creator" varchar(64) DEFAULT '',
|
"creator" varchar(64) DEFAULT '',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
@ -84,6 +84,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -101,7 +104,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(user.getEmail()),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(user.getEmail()),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -122,6 +125,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -139,7 +145,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,6 +167,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
@ -178,7 +187,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals(mailLogId, resultMailLogId);
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
// 断言调用
|
// 断言调用
|
||||||
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
||||||
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
eq(account.getId()), eq(template.getNickname()), eq(title), eq(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +209,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
|||||||
o.setParams(Lists.newArrayList("code", "op"));
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
});
|
});
|
||||||
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String title = RandomUtils.randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams)))
|
||||||
|
.thenReturn(title);
|
||||||
String content = RandomUtils.randomString();
|
String content = RandomUtils.randomString();
|
||||||
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
.thenReturn(content);
|
.thenReturn(content);
|
||||||
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.service.social;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
|
import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
||||||
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@Import(SocialUserServiceImpl.class)
|
@Import(SocialUserServiceImpl.class)
|
||||||
public class SocialUserServiceImplTest extends BaseDbAndRedisUnitTest {
|
public class SocialUserServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SocialUserServiceImpl socialUserService;
|
private SocialUserServiceImpl socialUserService;
|
||||||
|
@ -68,21 +68,21 @@
|
|||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- 商城相关模块。默认注释,保证编译速度 -->
|
<!-- 商城相关模块。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-promotion-biz</artifactId>
|
<!-- <artifactId>yudao-module-promotion-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-product-biz</artifactId>
|
<!-- <artifactId>yudao-module-product-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-trade-biz</artifactId>
|
<!-- <artifactId>yudao-module-trade-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- spring boot 配置所需依赖 -->
|
<!-- spring boot 配置所需依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<doc-alert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" />
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="应用名" prop="name">
|
<el-form-item label="应用名" prop="name">
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<doc-alert title="支付宝支付接入" url="https://doc.iocoder.cn/pay/alipay-pay-demo/" />
|
||||||
|
<doc-alert title="支付宝、微信退款接入" url="https://doc.iocoder.cn/pay/refund-demo/" />
|
||||||
|
<doc-alert title="微信公众号支付接入" url="https://doc.iocoder.cn/pay/wx-pub-pay-demo/" />
|
||||||
|
<doc-alert title="微信小程序支付接入" url="https://doc.iocoder.cn/pay/wx-lite-pay-demo/" />
|
||||||
|
|
||||||
<!-- 操作工具栏 -->
|
<!-- 操作工具栏 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<doc-alert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" />
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<doc-alert title="支付宝支付接入" url="https://doc.iocoder.cn/pay/alipay-pay-demo/" />
|
||||||
|
<doc-alert title="微信公众号支付接入" url="https://doc.iocoder.cn/pay/wx-pub-pay-demo/" />
|
||||||
|
<doc-alert title="微信小程序支付接入" url="https://doc.iocoder.cn/pay/wx-lite-pay-demo/" />
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<doc-alert title="支付宝、微信退款接入" url="https://doc.iocoder.cn/pay/refund-demo/" />
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||||
<el-form-item label="应用编号" prop="appId">
|
<el-form-item label="应用编号" prop="appId">
|
||||||
|
Loading…
Reference in New Issue
Block a user