From 9d2fe1cafa8a1d1b179c3a388e60150fa8a5c352 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Thu, 11 Jun 2020 15:45:49 +1000 Subject: [PATCH] feat: use the same system property for filtering interactions as Gradle/Maven #1104 --- provider/junit/README.md | 2 +- .../kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt | 2 +- .../dius/pact/provider/junit5/PactJUnit5VerificationProvider.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provider/junit/README.md b/provider/junit/README.md index 114bfb3036..c7f619a4a1 100644 --- a/provider/junit/README.md +++ b/provider/junit/README.md @@ -358,7 +358,7 @@ public class PactJUnitTest { **(version 4.1.2+)** -You can filter the interactions that are run by setting the JVM system property `pact.filter.interaction`. This propery +You can filter the interactions that are run by setting the JVM system property `pact.filter.description`. This propery takes a regular expression to match against the interaction description. **NOTE!** this property needs to be set on the test JVM if your build is running with Gradle or Maven. diff --git a/provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt b/provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt index 02be6d467d..a501dc50a7 100644 --- a/provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt +++ b/provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt @@ -182,7 +182,7 @@ open class InteractionRunner( } private fun interactionIncluded(interaction: Interaction): Boolean { - val interactionFilter = System.getProperty("pact.filter.interaction") + val interactionFilter = System.getProperty("pact.filter.description") return interactionFilter.isNullOrEmpty() || interaction.description.matches(Regex(interactionFilter)) } diff --git a/provider/junit5/src/main/kotlin/au/com/dius/pact/provider/junit5/PactJUnit5VerificationProvider.kt b/provider/junit5/src/main/kotlin/au/com/dius/pact/provider/junit5/PactJUnit5VerificationProvider.kt index f374afe7dc..1b9953d8dd 100644 --- a/provider/junit5/src/main/kotlin/au/com/dius/pact/provider/junit5/PactJUnit5VerificationProvider.kt +++ b/provider/junit5/src/main/kotlin/au/com/dius/pact/provider/junit5/PactJUnit5VerificationProvider.kt @@ -450,7 +450,7 @@ open class PactVerificationInvocationContextProvider : TestTemplateInvocationCon filterPactsByAnnotations(pacts, context.requiredTestClass) }.filter { p -> consumerName == null || p.consumer.name == consumerName } - val interactionFilter = System.getProperty("pact.filter.interaction") + val interactionFilter = System.getProperty("pact.filter.description") return Pair(pactSources.flatMap { pact -> pact.interactions .filter {