Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to JUnit 5.9 (#652 / 657) #657

Merged
merged 7 commits into from Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
junitVersion=5.8.2
junitVersion=5.9.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you know, this actually bumps the JUnit version we use under hood. It not just incorporates it in our build (as suggested in #652). From our contributing guidelines:

As documented Pioneer aims to use the lowest JUnit 5 version that supports Pioneer's feature set. At the same time, there is no general reason to hesitate with updating the dependency if a new feature requires a newer version or the old version has a severe bug.

Our code currently only fails with JUnit 5.9 due to test internals, not because we need a certain feature or fix. I'm cool with it, I just wonder if we can and/or want to stay on 5.8.2?

In any case, please also update the build accordingly:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right (e.g. #320 was the issue about upgrading to 5.6.0). But I understood your comment in the issue (#652) as a "we need it" and therefore created this PR. I'll check if I can get the build work without updating. If not I would call a vote on next maintainer meeting about either upgrading the Jupiter version or not adding it to the build matrix to avoid failing builds.

P.S. Will update the two sections of the workflow script you've linked while doing this.

Copy link
Member Author

@Bukama Bukama Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay in 5.9.0 the interface returns org.junit.jupiter.api.extension.ExecutableInvoker, but in 5.8.2 the class is placed org.junit.jupiter.engine.execution.ExecutableInvoker. So even if I "override" the getExecutableInvoker method, it would return the false interface. Therefore I would not create a second PR with only updating the build.yml as the 5.9 build will always fail.


# Ensure sufficient heap size, especially for Sonar.
org.gradle.jvmargs=-Xmx8g
Expand Down
Expand Up @@ -18,6 +18,7 @@
import java.util.function.Function;

import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExecutableInvoker;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestInstances;
import org.junit.jupiter.api.parallel.ExecutionMode;
Expand All @@ -42,11 +43,16 @@ public TestExtensionContext(Class<?> testClass, Method testMethod) {
this.testMethod = testMethod;
}

// @Override once we baseline against 5.8
@Override
public ExecutionMode getExecutionMode() {
throw NOT_SUPPORTED_IN_TEST_CONTEXT;
}

@Override
public ExecutableInvoker getExecutableInvoker() {
throw NOT_SUPPORTED_IN_TEST_CONTEXT;
}

@Override
public Optional<Class<?>> getTestClass() {
return Optional.of(testClass);
Expand Down
Expand Up @@ -576,7 +576,7 @@ void nonEnumParameterWithCartesianEnumSourceOmittedType() {
.hasSingleFailedContainer()
.withExceptionInstanceOf(ExtensionConfigurationException.class)
.hasMessageContaining("Could not provide arguments")
.getCause()
.cause()
.isInstanceOf(PreconditionViolationException.class)
.hasMessageContaining("Parameter of type %s must reference an Enum type", int.class);
}
Expand Down
Expand Up @@ -214,7 +214,7 @@ void noValuesCartesian() {
assertThat(results)
.hasSingleFailedContainer()
.withExceptionInstanceOf(ExtensionConfigurationException.class)
.getCause()
.cause()
.isInstanceOf(PreconditionViolationException.class)
.hasMessage("value must not be empty");
}
Expand Down