I upgraded to Pact JVM. Version "4.6.3"
Now my method in Consumer test looks like this (It is in Kotlin, but Java implementation will look quite similar):
@Pact(provider = "ArticlesProvider", consumer = "ArticlesConsumer")
fun createPact(builder: PactBuilder): V4Pact {
return builder
.usingLegacyDsl()
.given("Provider with three articles")
.uponReceiving("ListAllArticles")
.path("/articles.json")
.method("GET")
.willRespondWith()
.status(200)
.body(
"""
{
"articles" : [ {
"name" : "Basic news",
"length" : 104
}, {
"name" : "About dogs",
"length" : 5684
}, {
"name" : "Gossip",
"length" : 4512384
} ]
}
""".trimIndent()
)
.toPact(V4Pact::class.java)
}
I wonder how I should use builder without using usingLegacyDsl()
. What is a new way to specify this?
I may be dull, but I was trying to find some good samples/documentation for the new API but with no luck.