Open artemptushkin opened 2 years ago
Simple code example here : https://github.com/McKratt/greetings/blob/master/greetings-stat-service/stat-client/src/test/java/net/bakaar/greetings/stat/rest/client/GreetingsPactConsumerIT.java. Just update the version if it is not already made. I'm working on a branch currently.
If you want to use Pact specification V4, you can do something like this :
@Pact(consumer = "my-consumer", provider = "my-provider")
public V4Pact itProvidesStationPact(PactBuilder builder) {
return builder
.usingLegacyDsl()
.given("your given state")
.uponReceiving("your description")
.method("GET")
[...]
.toPact(V4Pact.class);
}
@mathieu-amblard Thank you, this is a suitable solution. In this issue I see confusion, shall we expect that the latest libraries publish v3 or v4 as default - this is not clear and forces us to do these workarounds
In addition to the existing questions: why is DSL marked as legacy(usingLegacyDsl
)? What is the new way of doing this?
Subject:
au.com.dius.pact.consumer:junit5:4.3.1
I'm migrating to pact-jvm
4.3.1
and noticed problems:It says that default Pact version is V3 but actually it defaults to v4 here
I went here as I got:
Having pacts defined like:
public au.com.dius.pact.core.model.V4Pact xxx(PactBuilder builder)
is mandatory?In general, I'd prefer an easy way to switch into version 4.
Workaround: Define explicitly version property, it works on the class level as well:
@PactTestFor(pactVersion = PactSpecVersion.V3