From 9f6b209e2e9463fb5163dd973ebc91563c7df58a Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Thu, 14 Nov 2024 15:58:48 +1100 Subject: [PATCH 1/2] chore: Add a test + update docs on JUnit 4 report dir default #1836 --- provider/junit/README.md | 3 ++- .../dius/pact/provider/junit/target/HttpTargetSpec.groovy | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/provider/junit/README.md b/provider/junit/README.md index 43e4f2cc5c..6b314e096a 100644 --- a/provider/junit/README.md +++ b/provider/junit/README.md @@ -616,7 +616,8 @@ JUnit mechanism. Additional reports can be generated from the tests. ## Enabling additional reports via annotations on the test classes A `@VerificationReports` annotation can be added to any pact test class which will control the verification output. The -annotation takes a list report types and an optional report directory (defaults to "target/pact/reports"). +annotation takes a list report types and an optional report directory (defaults to "target/pact/reports" for Maven +builds and "build/pact/reports" with Gradle). The currently supported report types are `console`, `markdown` and `json`. For example: diff --git a/provider/junit/src/test/groovy/au/com/dius/pact/provider/junit/target/HttpTargetSpec.groovy b/provider/junit/src/test/groovy/au/com/dius/pact/provider/junit/target/HttpTargetSpec.groovy index 9fe5eb2153..0b5fa94fe7 100644 --- a/provider/junit/src/test/groovy/au/com/dius/pact/provider/junit/target/HttpTargetSpec.groovy +++ b/provider/junit/src/test/groovy/au/com/dius/pact/provider/junit/target/HttpTargetSpec.groovy @@ -44,7 +44,10 @@ class HttpTargetSpec extends Specification { httpTarget.setupReporters(verifier) then: - 1 * verifier.setReporters { r -> r*.class*.simpleName == ['AnsiConsoleReporter', 'MarkdownReporter'] } + 1 * verifier.setReporters { r -> + r*.class*.simpleName == ['AnsiConsoleReporter', 'MarkdownReporter'] + r*.reportDir == ['build/pacts/reports' as File, 'build/pacts/reports' as File] + } } @SuppressWarnings('ClosureStatementOnOpeningLineOfMultipleLineClosure') From e95461a6a906205970941d992835dabcdf563c9e Mon Sep 17 00:00:00 2001 From: Christoph Burgmer Date: Thu, 14 Nov 2024 14:21:10 +0100 Subject: [PATCH 2/2] Fix path to Clojure example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f13a8b77d..6dab78336d 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ You want to look at: [groovy](consumer/groovy) or [junit](consumer/junit) ### (Use Clojure I) Clojure can call out to Java, so have a look at [junit](consumer/junit). For an example -look at [example_clojure_consumer_pact_test.clj](https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit/src/test/clojure/au/com/pact-foundation/pact/consumer/junit/example_clojure_consumer_pact_test.clj). +look at [example_clojure_consumer_pact_test.clj](https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit/src/test/clojure/au/com/dius/pact/consumer/junit/example_clojure_consumer_pact_test.clj). ### I Use some other jvm language or test framework