From a5729d6ef04203491e2dc42df61f2820806a8405 Mon Sep 17 00:00:00 2001 From: Andreas Schmid Date: Thu, 4 Jul 2019 21:30:37 +0200 Subject: [PATCH] fix compatibility issue with new junit-jupiter version 5.4.* (#118) --- .travis.yml | 4 ++-- README.md | 1 + build.gradle | 2 +- junit-jupiter-params/pom.xml | 4 ++-- .../dataprovider/AbstractUseDataProviderArgumentProvider.java | 3 ++- junit-jupiter/pom.xml | 2 +- .../UseDataProviderInvocationContextProvider.java | 3 ++- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88a10292..b04bce42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ dist: trusty sudo: false script: - - ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.0.3 -PskipSpotBugs - - ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.1.1 -PskipSpotBugs + - ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.4.0 -PskipSpotBugs + - ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.4.2 -PskipSpotBugs - ./gradlew build diff --git a/README.md b/README.md index 66590a54..a79ef08e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Have a look to this repositories [Wiki](/../../wiki/) pages for documenation, us * [Requirements](/../../wiki/Getting-started#requirements) * [Download](/../../wiki/Getting-started#download) * [Usage](/../../wiki/Getting-started#usage) +* [Version compatibility](/../../wiki/Version-compatibility) * [Migration guides](/../../wiki/Migration-guides) * [Migration from v1 to v2](/../../wiki/Migration-guides#migration-from-v1-to-v2) * [Migration to JUnit5](/../../wiki/Migration-guides#migration-to-junit5) diff --git a/build.gradle b/build.gradle index 39d60237..a9dc2d34 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ if (!hasProperty("junit4Version")) { // set default junit version if not set via println "Using JUnit4 version ${junit4Version} for current build." if (!hasProperty("junitJupiterVersion")) { // set default junit version if not set via command line - ext.junitJupiterVersion = "5.2.0" + ext.junitJupiterVersion = "5.4.0" } println "Using JUnit Jupiter version ${junitJupiterVersion} for current build." diff --git a/junit-jupiter-params/pom.xml b/junit-jupiter-params/pom.xml index 1990315d..f8978298 100644 --- a/junit-jupiter-params/pom.xml +++ b/junit-jupiter-params/pom.xml @@ -70,12 +70,12 @@ org.junit.jupiter junit-jupiter-params - 5.1.1 + 5.4.2 org.junit.jupiter junit-jupiter-engine - 5.1.1 + 5.4.2 com.github.spotbugs diff --git a/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractUseDataProviderArgumentProvider.java b/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractUseDataProviderArgumentProvider.java index f6896da1..47692683 100644 --- a/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractUseDataProviderArgumentProvider.java +++ b/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractUseDataProviderArgumentProvider.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.extension.ExtensionContext.Namespace; import org.junit.jupiter.api.extension.ExtensionContext.Store; import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.engine.config.DefaultJupiterConfiguration; import org.junit.jupiter.engine.execution.ExecutableInvoker; import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.jupiter.params.provider.Arguments; @@ -135,7 +136,7 @@ protected Object invokeDataProviderMethodToRetrieveData(Method dataProviderMetho } try { // TODO how to not require junit-jupiter-engine dependency and reuse already existing ExtensionRegistry? - ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(emptyConfigurationParameters()); + ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(new DefaultJupiterConfiguration(emptyConfigurationParameters())); Object data = executableInvoker.invoke(dataProviderMethod, context.getTestInstance().orElse(null), context, extensionRegistry); if (cacheDataProviderResult) { diff --git a/junit-jupiter/pom.xml b/junit-jupiter/pom.xml index fb13630c..ee80816a 100644 --- a/junit-jupiter/pom.xml +++ b/junit-jupiter/pom.xml @@ -73,7 +73,7 @@ org.junit.jupiter junit-jupiter-engine - 5.1.1 + 5.4.2 com.github.spotbugs diff --git a/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/UseDataProviderInvocationContextProvider.java b/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/UseDataProviderInvocationContextProvider.java index 10a639e0..b892741d 100644 --- a/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/UseDataProviderInvocationContextProvider.java +++ b/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/UseDataProviderInvocationContextProvider.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.extension.ExtensionContext.Store; import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.TestTemplateInvocationContext; +import org.junit.jupiter.engine.config.DefaultJupiterConfiguration; import org.junit.jupiter.engine.execution.ExecutableInvoker; import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.ConfigurationParameters; @@ -157,7 +158,7 @@ protected Object invokeDataProviderMethodToRetrieveData(Method dataProviderMetho } try { // TODO how to not require junit-jupiter-engine dependency and reuse already existing ExtensionRegistry? - ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(emptyConfigurationParameters()); + ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(new DefaultJupiterConfiguration(emptyConfigurationParameters())); Object data = executableInvoker.invoke(dataProviderMethod, context.getTestInstance().orElse(null), context, extensionRegistry); if (cacheDataProviderResult) {