PactDslJsonObject getting resolved to Empty Map {}

143 Views Asked by At

The object, below, while debugging is being displayed as {} instead of {"types" : ["Ice Cream"] } as one would expect. Why is this happening.

  PactDslJsonObject  resquest = new PactDslJsonObject()         
    .array("type").stringMatcher("\w+","Ice Cream");
1

There are 1 best solutions below

2
On BEST ANSWER

Sorry to answer my own question. Looks like we must close the children of PactDslJsonObject or whatever (could be an array as well in that case you will have to close the object withing the array.) is it that we would like to request or respond from aor to a service.

So, in this case it should be,

DslPart response = new PactDslJsonObject()         
.array("type").stringMatcher("\w+","Ice Cream").closeArray();