Skip to content

Commit

Permalink
Update to JUnit Jupiter 5.9 (junit-pioneer#652 / junit-pioneer#657)
Browse files Browse the repository at this point in the history
Updates the used JUnit Jupiter version

closes: junit-pioneer#652
PR: junit-pioneer#657
  • Loading branch information
Bukama committed Sep 20, 2022
1 parent 3e5e59b commit c54617c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -118,7 +118,7 @@ jobs:
strategy:
matrix:
java: [ 11, 17 ]
junit-version: [ '5.8.2' ]
junit-version: [ '5.9.0' ]
modular: [true, false]
os: [ubuntu, macos, windows]
name: with Java ${{ matrix.java }}, JUnit ${{ matrix.junit-version }}, Modular ${{ matrix.modular }} on ${{ matrix.os }}
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
junit-version: [ '5.8.2' ]
junit-version: [ '5.9.0' ]
modular: [true, false]
os: [ubuntu, macos, windows]
name: Experimental build with newest JDK early-access build and Gradle release candidate
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
junitVersion=5.8.2
junitVersion=5.9.0

# Ensure sufficient heap size, especially for Sonar.
org.gradle.jvmargs=-Xmx8g
Expand Down
Expand Up @@ -13,7 +13,10 @@
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@EnabledForJreRange(max = JRE.JAVA_16, disabledReason = "See: https://github.com/junit-pioneer/junit-pioneer/issues/509")
public class EnvironmentVariablesExtensionDemo {

// tag::environment_clear_simple[]
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 @@ -16,8 +16,11 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.junitpioneer.testkit.PioneerTestKit;

@EnabledForJreRange(max = JRE.JAVA_16, disabledReason = "See: https://github.com/junit-pioneer/junit-pioneer/issues/509")
@DisplayName("Abstract entry-based extension")
@WritesEnvironmentVariable
@WritesSystemProperty
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

0 comments on commit c54617c

Please sign in to comment.