remondis-it / pact-consumer-builder

Library for generating pact consumer expectations from java beans
Apache License 2.0
14 stars 6 forks source link

More than one item in the list #26

Open romainvv opened 4 years ago

romainvv commented 4 years ago

Hello,

Is there a way to generate a pact with more than one item in list/array using pact-consumer-builder ? When I fill a java list with two items, the pact-consumer-builder only generate a DslPart with one item in the array. I would like to have all the items that i provided in the java list. GenericListDummy<Dummy> genericDummy = new GenericListDummy<>(asList(new Dummy("A"), new Dummy("B"))); ... JSONAssert.assertEquals("{\"list\":[{\"string\":\"B\"}, {\"string\":\"A\"}]}", actualJson, JSONCompareMode.NON_EXTENSIBLE); // instead of JSONAssert.assertEquals("{\"list\":[{\"string\":\"B\"}]}", actualJson, JSONCompareMode.NON_EXTENSIBLE);

Thanks for your time

schuettec commented 4 years ago

Hi, currently the pact-consumer-builder does not support this. A refactoring would be required, because the list access is currently hard-coded to only use the first value if a list is supplied. Plus that we need an API change for the different modifiers. Would be a lot to do.

Since the PactDslJson-API supports this, we should support this, too. But I cannot guarantee that I can provide this feature soon, sorry.