我想使用来自提供者的合约文件来运行针对消费者的测试。我有
{
"provider": {
"name": "Provider"
},
"consumer": {
"name": "Consumer"
},
"interactions": [
{
"description": "Get data",
"request": {
"method": "Get",
"path": "/data/1"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"message": ""
}
},
"providerState": "state"
}
],
"metadata": {
"pact-specification": {
"version": "2.0.0"
},
"pact-jvm": {
"version": "3.5.6"
}
}
并希望使用它来生成协议模拟服务器,例如:
RequestResponsePact pact = new RequestResponsePact(mockServerDescriptionString);
可以这样做吗?
No.但是您可以使用 pact-stub-server 或 pact-stub-service CLI