Skip to content

Commit

Permalink
Merge branch 'issue118-compatibility-junit-jupiter-5.5.0'
Browse files Browse the repository at this point in the history
* issue118-compatibility-junit-jupiter-5.5.0:
  fix compatibility with 5.5.0 and above (#118)
  • Loading branch information
aaschmid committed Jul 6, 2019
2 parents 469a6f2 + 594f099 commit e7cdfee
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ dist: trusty
sudo: false

script:
- ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.4.0 -PskipSpotBugs
- ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.4.2 -PskipSpotBugs
- ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.5.0-RC2 -PskipSpotBugs
- ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.5.0 -PskipSpotBugs

- ./gradlew build

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.0"
ext.junitJupiterVersion = "5.5.0"
}
println "Using JUnit Jupiter version ${junitJupiterVersion} for current build."

Expand All @@ -39,7 +39,7 @@ subprojects {
apply plugin: "osgi"

group = "com.tngtech.junit.dataprovider"
version = "2.5"
version = "2.6-SNAPSHOT"

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
Expand Down
4 changes: 2 additions & 2 deletions junit-jupiter-params/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.4.2</version>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.2</version>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static com.tngtech.junit.dataprovider.Preconditions.checkNotNull;
import static com.tngtech.junit.dataprovider.resolver.DataProviderMethodResolverHelper.findDataProviderMethods;
import static org.junit.jupiter.engine.extension.ExtensionRegistry.createRegistryWithDefaultExtensions;
import static org.junit.jupiter.engine.extension.MutableExtensionRegistry.createRegistryWithDefaultExtensions;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand All @@ -13,6 +13,7 @@
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.jupiter.api.extension.InvocationInterceptor;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.jupiter.engine.config.DefaultJupiterConfiguration;
import org.junit.jupiter.engine.execution.ExecutableInvoker;
Expand Down Expand Up @@ -136,9 +137,10 @@ protected Object invokeDataProviderMethodToRetrieveData(Method dataProviderMetho
}
try {
// TODO how to not require junit-jupiter-engine dependency and reuse already existing ExtensionRegistry?
ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(new DefaultJupiterConfiguration(emptyConfigurationParameters()));
ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(
new DefaultJupiterConfiguration(emptyConfigurationParameters()));
Object data = executableInvoker.invoke(dataProviderMethod, context.getTestInstance().orElse(null), context,
extensionRegistry);
extensionRegistry, InvocationInterceptor::interceptTestFactoryMethod);
if (cacheDataProviderResult) {
store.put(dataProviderMethod, data);
}
Expand Down
2 changes: 1 addition & 1 deletion junit-jupiter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.2</version>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static com.tngtech.junit.dataprovider.Preconditions.checkArgument;
import static com.tngtech.junit.dataprovider.Preconditions.checkNotNull;
import static com.tngtech.junit.dataprovider.resolver.DataProviderMethodResolverHelper.findDataProviderMethods;
import static org.junit.jupiter.engine.extension.ExtensionRegistry.createRegistryWithDefaultExtensions;
import static org.junit.jupiter.engine.extension.MutableExtensionRegistry.createRegistryWithDefaultExtensions;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand All @@ -15,6 +15,7 @@
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.jupiter.api.extension.InvocationInterceptor;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
import org.junit.jupiter.engine.config.DefaultJupiterConfiguration;
Expand Down Expand Up @@ -158,9 +159,10 @@ protected Object invokeDataProviderMethodToRetrieveData(Method dataProviderMetho
}
try {
// TODO how to not require junit-jupiter-engine dependency and reuse already existing ExtensionRegistry?
ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(new DefaultJupiterConfiguration(emptyConfigurationParameters()));
ExtensionRegistry extensionRegistry = createRegistryWithDefaultExtensions(
new DefaultJupiterConfiguration(emptyConfigurationParameters()));
Object data = executableInvoker.invoke(dataProviderMethod, context.getTestInstance().orElse(null), context,
extensionRegistry);
extensionRegistry, InvocationInterceptor::interceptTestFactoryMethod);
if (cacheDataProviderResult) {
store.put(dataProviderMethod, data);
}
Expand Down

0 comments on commit e7cdfee

Please sign in to comment.