Skip to content

Commit

Permalink
Corrected the readme for JUnit 5 tests #576
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Apr 22, 2018
1 parent 611d98a commit 7970910
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ You want to look at: [scala-pact](https://github.com/ITV/scala-pact) or [pact-jv

### I Use Java

You want to look at: [pact-jvm-consumer-junit](pact-jvm-consumer-junit). Also, if you are using Java 8, there is [an
You want to look at: [pact-jvm-consumer-junit](pact-jvm-consumer-junit) for JUnit 4 tests and
[pact-jvm-consumer-junit5](pact-jvm-consumer-junit5) for JUnit 5 tests. Also, if you are using Java 8, there is [an
updated DSL for consumer tests](pact-jvm-consumer-java8).

### I Use Groovy or Grails
Expand Down
9 changes: 5 additions & 4 deletions pact-jvm-consumer-junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interactions for the test.
Then the final step is to use the `@PactTestFor` annotation to tell the Pact extension how to setup the Pact test. You
can either put this annotation on the test class, or on the test method. For examples see
[ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) and
[MultiTest](/home/ronald/Development/Projects/Pact/pact-jvm/pact-jvm-consumer-junit5/src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy).
[MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy).

The `@PactTestFor` annotation allows you to control the mock server in the same way as the JUnit 4 `PactProviderRule`. It
allows you to set the hostname to bind to (default is `localhost`) and the port (default is to use a random port). You
Expand All @@ -63,7 +63,7 @@ public class ExampleJavaConsumerPactTest {
**NOTE on the hostname**: The mock server runs in the same JVM as the test, so the only valid values for hostname are:

| hostname | result |
| ======== | ====== |
| -------- | ------ |
| `localhost` | binds to the address that localhost points to (normally the loopback adapter) |
| `127.0.0.1` or `::1` | binds to the loopback adapter |
| host name | binds to the default interface that the host machines DNS name resolves to |
Expand All @@ -72,12 +72,13 @@ public class ExampleJavaConsumerPactTest {
#### Matching the interactions by provider name

If you set the `providerName` on the `@PactTestFor` annotation, then the first method with a `@Pact` annotation with the
same provider name will be used.
same provider name will be used. See [ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) for
an example.

#### Matching the interactions by method name

If you set the `pactMethod` on the `@PactTestFor` annotation, then the method with the provided name will be used (it still
needs a `@Pact` annotation).
needs a `@Pact` annotation). See [MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy) for an example.

## Unsupported

Expand Down

0 comments on commit 7970910

Please sign in to comment.