Closed ninckblokje closed 10 years ago
Yes it is possible, if you use the clear function it will only remove the expectations that exactly match the request you provide, i.e:
mockServerClient.clear(
request()
.withPath("/test")
.withBody(xpath("//test=1"))
);
Hi,
Thanks for the quick response! When I try that using JSON the expectations appears to remain.
My JSON for setting the expectation looks like this: httpRequest": { "method": "POST", "path": "/test", "body": { "type": "XPATH", "value": "//test=1" }, "headers": [ { "name": "SOAPAction", "values": ["\"\""] } ] }, "httpResponse": { "statusCode": 200, "headers": [ { "name": "Content-Type", "values": ["application/soap+xml; charset=utf-8"] } ], "body": "[SOME_SOAP_ENVELOPE]" }
My JSON for removing the expectation looks like this: { "method": "POST", "path": "/test", "body": { "type": "XPATH", "value": "//test=1" }, "headers": [ { "name": "SOAPAction", "values": ["\"\""] } ] }
When I ommit the body part the expectation is removed.
Jeroen
ok I'll take a look
I've been away this weekend but I'll take a look in the next couple of days and add extra tests to make sure there aren't any bugs (or fix them if there are).
I resolved the issue and added a test for this scenario
Hi,
I have a question concerning the removing of specific expectations. Is it possible to remove a single expectation for a specific path?
For example: I have set an expectation for path /test with an XPath body match on //test=1. I have set a second expectation for path /test with an XPath body match on //test=2. Is it possible to remove the first expectation without removing the second one, even if no message has been received by the mock server?
Jeroen