Skip to content

Commit

Permalink
chore: Update Junit 5 readme with V4 Pact example #1745
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Apr 22, 2024
1 parent 15d4ae9 commit adb5285
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions consumer/junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit adb5285

Please sign in to comment.