Open wesleythomaswilliams opened 3 years ago
Looks like you can already split the large call chain up. I was about to remove the error by splitting out four objects:
PactDslJsonBody productSpecification = new PactDslJsonBody()
.integerType("multiPackQuantity", 1)
.booleanType("copyrightInd", false)
.stringType("copyrightDets", "sample_data")
.booleanType("batteryRequired", true)
.booleanType("batteryIncluded", false)
.booleanType("beabApproved", false)
.stringType("beabCertNo", "sample_data")
.booleanType("plugRequired", false)
.booleanType("plugIncluded", false)
.booleanType("bulbRequired", false)
.booleanType("bulbIncluded", false)
.decimalType("voltage", 10.10)
.decimalType("wattage", 10.10);
and then in the main body:
.object("productSpecification", productSpecification)
This will add "productSpecification" as a object defined by the productSpecification
body. You also don't need to call close, it is done for you.
You can now also split out the object definitions with minArrayLike
now, ie.
PactDslJsonBody colours = new PactDslJsonBody()
.stringType("name", "sample_data")
.booleanType("primary", false)
.stringType("colourCode", "sample_data")
.stringType("hexCode", "sample_data")
.stringType("rgbCode", "sample_data");
minArrayLike("colours", 1, colours)
A PactDslJsonBody with 432+ lines causes a java.lang.StackOverflowError on the Java 1.8 compiler. I can't include the example directly here, but @uglyog has access via slack and I'm happy to provide directly on request: https://pact-foundation.slack.com/archives/G01D62WEB60/p1609953945002100
Pact Version: `au.com.dius