Pact Groovy Mock with Array in Body

2019-08-11 19:24发布

问题:

I would like to model my much such that its body consists of an array of n elements. The below code only creates one element in the array, when it should produce three.

withBody(eachLike(3, {
   id identifier
   state("COMPLETED")
   type regexp("(A|B)", "A")
 }))

Oddly enough, if I name the name collection, it actually generates three objects:

withBody {
  namedObject eachLike(3, {
  id identifier
  })
}

Where do I go wrong? Is this a bug?