Hi all. Does <Pact consumer> supersede <pact-jvm-c...
# pact-jvm
a
Hi all. Does Pact consumer supersede pact-jvm-consumer-junit? Edit - More specifically, the new Lambda DSL supposedly does supersede pact-jvm-consumer-junit if I understood the docs correctly. if it does, I can’t find a maven repository for io.pactfoundation.
r
These are different things, one provides support for using JUnit to write Pact tests, the other for building JSON payloads in Java.
If you write JUnit Pact tests using JSON payloads in Java, you need both
a
Thanks for the prompt reply. How come we need both when pact-jvm-consumer-unit ships with a DSL too? E.g.:
Copy code
import au.com.dius.pact.consumer.dsl.DslPart;
import au.com.dius.pact.consumer.dsl.PactDslJsonArray;
import au.com.dius.pact.consumer.dsl.PactDslJsonBody;
import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
r
That is the older support which does not use lambda functions. But it works.
a
Right, thanks for clarifying that.. how exactly does one get their hands on the new Lamba DSL?
r
If you included the Pact JUnit jar, it will be available on your classpath (transitive dependency)
If you have dependency issues, then also include the consumer jar
a
Is this available only after 4.3.x? I’ve already got
testImplementation 'au.com.dius.pact.consumer:junit:4.2.20'
r
No, it has been available for a long time
a
Weird, because:
r
Ah! the examples are wrong. The package is
<http://au.com|au.com>.dius.pact.consumer.dsl
🙌 1
a
Ah, the docs need updating.
Copy code
au.com.dius.pact.consumer.dsl.LambdaDsl.newJsonArray;
works
I reckon it’d be really helpful to clarify on the jUnit page(s) that the older DSL is deprecated in favour of the lambda DSL. I didn’t look into the new DSL’s page (which looks much more clean) until we started running into issues 😭
r
It's not deprecated, the newer one just wraps the older one and allows the use of lambda functions
a
Right. I’m yet to try the new DSL, I wonder if that’d fix my issue, although nothing seems wrong at the Pact generation side. Perhaps it’s the provider…