You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: consumer/junit5/README.md
+22-2
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The library is available on maven central using:
9
9
10
10
* group-id = `au.com.dius.pact.consumer`
11
11
* artifact-id = `junit5`
12
-
* version-id = `4.2.X`
12
+
* version-id = `4.4.X`
13
13
14
14
## Usage
15
15
@@ -234,6 +234,26 @@ message queue or topic as a notification or event. With Pact tests, we will be t
234
234
works with the messages setup as the expectations in test. This should be the message handler code that processes the
235
235
actual messages that come off the message queue in production.
236
236
237
+
For example:
238
+
239
+
```java
240
+
builder.given("Some Provider State")
241
+
.expectsToReceive("a test message")
242
+
.withContent("{\"value\": \"test\"}")
243
+
.toPact();
244
+
```
245
+
246
+
or using a Dsl object:
247
+
248
+
```java
249
+
builder.given("Some Provider State")
250
+
.expectsToReceive("a test message")
251
+
.withContent(newPactDslJsonBody()
252
+
.stringValue("testParam1", "value1")
253
+
.stringValue("testParam2", "value2"))
254
+
.toPact();
255
+
```
256
+
237
257
You can use either the V3MessagePact or the V4AsynchronousMessage interaction to test these types of interactions.
238
258
239
259
For a V3 message pact example, see [AsyncMessageTest](https://github.com/pact-foundation/pact-jvm/blob/ac6a0eae0b18183f6f453eafddb89b90741ace42/consumer/junit5/src/test/java/au/com/dius/pact/consumer/junit5/AsyncMessageTest.java).
0 commit comments