复制代码
### 2.增加mock配置
可参考com.xh.utils.mock.dto.MethodMockDTO中的注释进行配置,各字段有详细解释;
mockRequestDTOsList和mockResponseDTOS 都是List表示支持同一个方法的多组入参和出参匹配。
例如下面的配置:
{
“com.xh.utils.mock.test.TestMockClass#testSimpleWithoutInput”: { //简单无入参的配置
"openMock": true, //是否开启配置
"mockResponseDTOS": [ //只需要配置response即可,虽然是数组,但只能配置一个
{
"mockType": 1, //"mockType" 为1表示自己构造返回,不填默认为修改类型的出参,效果和"mockType": 0一致
"responseContent": false
}
]
},
“com.xh.utils.mock.test.TestMockClass#testSimpleInputOutput”: {
"openMock": true,
"mockRequestDTOsList": [ //数组下标为1的入参配置对应下标为1的出参配置
[
{
"requestType": 1, //requestType为1表示基本类型或者集合类型的入参,requestType不填默认为复杂类型的入参,效果和requestType为0一致
"requestCompareContent": "mock"
}
]
],
"mockResponseDTOS": [
{
"mockType": 1,
"responseContent": true
}
]
},
“com.xh.utils.mock.test.TestMockClass#testComplexInputOutput”: { //复杂类型的配置
"openMock": true,
"mockRequestDTOsList": [
[
{
"requestType": 1,
"requestCompareContent": "1"