Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import static org.hibernate.testing.bytecode.enhancement.extension.engine.BytecodeEnhancedClassUtils.enhanceTestClass;
import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashSet;
Expand Down Expand Up @@ -39,10 +41,12 @@
import org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor;
import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor;
import org.junit.jupiter.engine.descriptor.LauncherStoreFacade;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor;
import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext;
import org.junit.platform.engine.EngineDiscoveryRequest;
import org.junit.platform.engine.EngineExecutionListener;
import org.junit.platform.engine.ExecutionRequest;
import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.UniqueId;
Expand Down Expand Up @@ -213,9 +217,20 @@ private Method findMethodReplacement(ClassTestDescriptor updated, Method testMet

@Override
protected JupiterEngineExecutionContext createExecutionContext(ExecutionRequest request) {
try {
// Try constructing the JupiterEngineExecutionContext the way it was done in 5.12 and before
final Constructor<JupiterEngineExecutionContext> constructorV5_12 = JupiterEngineExecutionContext.class
.getConstructor( EngineExecutionListener.class, JupiterConfiguration.class );
return constructorV5_12.newInstance( request.getEngineExecutionListener(), this.getJupiterConfiguration( request ) );
}
catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
// Ignore errors as they are probably due to version mismatches and try the 5.13 way
}

return new JupiterEngineExecutionContext(
request.getEngineExecutionListener(),
this.getJupiterConfiguration( request )
this.getJupiterConfiguration( request ),
new LauncherStoreFacade( request.getStore() )
);
}

Expand Down Expand Up @@ -272,6 +287,11 @@ public boolean isParallelExecutionEnabled() {
return configuration.isParallelExecutionEnabled();
}

@Override
public boolean isClosingStoredAutoCloseablesEnabled() {
return configuration.isClosingStoredAutoCloseablesEnabled();
}

@Override
public boolean isExtensionAutoDetectionEnabled() {
return configuration.isExtensionAutoDetectionEnabled();
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ dependencyResolutionManagement {
library( "xjc", "org.glassfish.jaxb", "jaxb-xjc" ).versionRef( xjcVersion )
}
testLibs {
def junit5Version = version "junit5", "5.12.0"
def junit5Version = version "junit5", "5.13.0"
def junit4Version = version "junit4", "4.13.2"
def junit5LauncherVersion = version "junit5Launcher", "1.12.0"

Expand Down