W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
考慮以下契約合同的示例,該契約是src/test/resources/contracts
文件夾下的文件。
{ "provider": { "name": "Provider" }, "consumer": { "name": "Consumer" }, "interactions": [ { "description": "", "request": { "method": "PUT", "path": "/fraudcheck", "headers": { "Content-Type": "application/vnd.fraud.v1+json" }, "body": { "clientId": "1234567890", "loanAmount": 99999 }, "generators": { "body": { "$.clientId": { "type": "Regex", "regex": "[0-9]{10}" } } }, "matchingRules": { "header": { "Content-Type": { "matchers": [ { "match": "regex", "regex": "application/vnd\\.fraud\\.v1\\+json.*" } ], "combine": "AND" } }, "body": { "$.clientId": { "matchers": [ { "match": "regex", "regex": "[0-9]{10}" } ], "combine": "AND" } } } }, "response": { "status": 200, "headers": { "Content-Type": "application/vnd.fraud.v1+json;charset=UTF-8" }, "body": { "fraudCheckStatus": "FRAUD", "rejectionReason": "Amount too high" }, "matchingRules": { "header": { "Content-Type": { "matchers": [ { "match": "regex", "regex": "application/vnd\\.fraud\\.v1\\+json.*" } ], "combine": "AND" } }, "body": { "$.fraudCheckStatus": { "matchers": [ { "match": "regex", "regex": "FRAUD" } ], "combine": "AND" } } } } } ], "metadata": { "pact-specification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.13" } } }
本部分有關(guān)使用Pact的其余部分參考前面的文件。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: