В моем json запросе startdate, endDate, который изменяется для каждого запроса. После записи я не могу снова сопоставить этот запрос.
Я записываю с помощью
WireMockServer wireMockServer1 = new WireMockServer(
options().port(8093).usingFilesUnderDirectory("/data/testing"));
RecordSpecBuilder recorbuilder=new RecordSpecBuilder().chooseBodyMatchTypeAutomatically(true,true,false);
wireMockServer1.snapshotRecord(recorbuilder);
wireMockServer1.start();
WireMock wireMockClient1 = new WireMock(8093);
wireMockClient1.startStubRecording("https://test:5005");
// Code..which makes call to http://localhost:8093/testing and it records my request
wireMockClient1.stopStubRecording();
wireMockServer1.stop();
после того, как я записываю, я использую ниже код
WireMockServer wireMockServer1 = new WireMockServer(
options().port(8093).usingFilesUnderDirectory("/data/testing"));
wireMockServer1.start();
// Code which makes call to http://localhost:8093/testing and gets the recorded request
wireMockServer1.stop();
My записано json
{
"id" : "427dfa5b-e3de-4ac2-b889-22f379be8bbd",
"name" : "testing",
"request" : {
"url" : "/testing",
"method" : "POST",
"bodyPatterns" : [ {
"equalToJson" : "{\"startDate\":1559171979657,\"endDate\":1590707979657,\"testing1\":1,\"testing2\":\"R\"}",
"ignoreArrayOrder" : true,
"ignoreExtraElements" : true
} ]
},
"response" : {
"status" : 200,
"body" : "{ testing.... }",
"headers" : {
"X-Backside-Transport" : "OK OK,OK OK",
"Connection" : "Keep-Alive",
"X-Global-Transaction-ID" : "123456",
"Content-Type" : "application/json",
"Date" : "Thu, 28 May 2020 23:19:46 GMT"
}
},
"uuid" : "427dfa5b-e3de-4ac2-b889-22f379be8bbd",
"persistent" : true,
"insertionIndex" : 53
}