Ashish Merani
09/14/2022, 11:01 PMid
to ids
the contract test would fail?
{
"id": "5",
"type": "something"
}
I looked at .stringValue which only compares "5" and not id
itself.Timothy Jones
09/15/2022, 1:12 AM"id"
) is not there any more (which would happen if it was renamed) then the pact will fail. If it's not failing, there's something else going onAshish Merani
09/15/2022, 1:22 AMid
to ids
in provider. Contract still passed. I tired using .stringType("id", "5")
from PactDslJsonBody
and
object.stringType("id", "5");
from LambdaDsl.newJsonBody;
still the test won't fail.Ashish Merani
09/15/2022, 1:24 AM.stringType("id", "5")
(from consumer) that it does fail.Timothy Jones
09/15/2022, 1:26 AMid
property?Timothy Jones
09/15/2022, 1:27 AMAshish Merani
09/15/2022, 1:27 AMcontext.verifyInteraction();
Boris
09/15/2022, 1:37 AMid
to ids
), the consumer test still won't fail, but the provider verification should.Timothy Jones
09/15/2022, 1:47 AMAshish Merani
09/15/2022, 1:49 AMid
in contract and provider renamed it to ids
I am expecting the provider test to fail but it passes.Ashish Merani
09/15/2022, 1:52 AMPactVerificationContext.kt
expectedResponse has
status: 200
headers: {Content-Type=[application/json]}
matchers: MatchingRules(rules={body=Category(name=body, matchingRules={$.id=MatchingRuleGroup(rules=[au.com.dius.pact.core.model.matchingrules.TypeMatcher@3bf0d1fb], ruleLogic=AND, cascaded=false), $.type=MatchingRuleGroup(rules=[au.com.dius.pact.core.model.matchingrules.TypeMatcher@3bf0d1fb], ruleLogic=AND, cascaded=false)})})
generators: Generators(categories={})
body: PRESENT({"id":"5","type":"House"})
actualResponse has
ProviderResponse(statusCode=200, headers={Date=[Thu, 15 Sep 2022 ], Content-Type=[application/json], Transfer-Encoding=[chunked]}, contentType=application/json, body={"type":"House","id":"5"})
Ashish Merani
09/15/2022, 1:52 AMAshish Merani
09/15/2022, 1:53 AMid
to ids
tho 🤔Timothy Jones
09/15/2022, 4:49 AMTimothy Jones
09/15/2022, 4:49 AMAshish Merani
09/15/2022, 2:41 PMAshish Merani
09/15/2022, 2:41 PMAshish Merani
09/15/2022, 2:42 PMBoris
09/16/2022, 1:43 AMBoris
09/16/2022, 1:43 AMAshish Merani
09/16/2022, 1:47 AMAshish Merani
09/16/2022, 1:49 AMAshish Merani
09/16/2022, 1:49 AMBoris
09/16/2022, 1:50 AMids
everywhere. If the actual response (in & out of the test) returns {"type":"House","id":"5"}
, then your controller is rendering out a class (or whatever) with id
.Boris
09/16/2022, 1:50 AMBoris
09/16/2022, 1:51 AMAshish Merani
09/16/2022, 1:54 AMAshish Merani
09/16/2022, 1:57 AMAshish Merani
09/16/2022, 1:58 AMBoris
09/16/2022, 1:59 AMAshish Merani
09/16/2022, 2:01 AMAshish Merani
09/16/2022, 2:01 AMBoris
09/16/2022, 2:02 AMBoris
09/16/2022, 2:02 AMResponse.of
to work in the controller.
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
Ashish Merani
09/16/2022, 2:16 AMid
on this line https://github.com/pact-foundation/pact-workshop-jvm-spring/blob/main/provider/src/main/java/au/com/dius/pactworkshop/provider/Product.java#L7 and everything below that to ids
Boris
09/16/2022, 2:17 AMBoris
09/16/2022, 2:18 AMgetId
to getIds
?Ashish Merani
09/16/2022, 2:34 AMBoris
09/16/2022, 2:35 AMid
in the response :)Ashish Merani
09/16/2022, 2:53 AM