From be4b6968b206c332846fe1371dcecc6771d90140 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Wed, 20 Dec 2023 15:53:00 +1100 Subject: [PATCH] chore: Update Junit 5 readme with V4 Pact example #1745 --- consumer/junit5/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/consumer/junit5/README.md b/consumer/junit5/README.md index b4beccb22..568c947e0 100644 --- a/consumer/junit5/README.md +++ b/consumer/junit5/README.md @@ -49,6 +49,22 @@ interactions for the test. } ``` +Note for V4 Pacts, the format of the method needs to be +```java + @Pact(provider="ArticlesProvider", consumer="test_consumer") + public V4Pact createPact(PactDslWithProvider builder) { + return builder + .given("test state") + .uponReceiving("ExampleJavaConsumerPactTest test interaction") + .path("/articles.json") + .method("GET") + .willRespondWith() + .status(200) + .body("{\"responsetest\": true}") + .toPact(V4Pact.class); + } +``` + ### 3. Link the mock server with the interactions for the test with `@PactTestFor` Then the final step is to use the `@PactTestFor` annotation to tell the Pact extension how to setup the Pact test. You