Merge pull request #19907 from dreis2211

* pr/19907:
  Upgrade to JUnit Jupiter 5.6.0

Closes gh-19907
pull/19936/head
Stephane Nicoll 5 years ago
commit ac0bb2b7c2

@ -25,7 +25,7 @@ dependencies {
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}") implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}")
testImplementation("org.assertj:assertj-core:3.11.1") testImplementation("org.assertj:assertj-core:3.11.1")
testImplementation("org.apache.logging.log4j:log4j-core:2.12.1") testImplementation("org.apache.logging.log4j:log4j-core:2.12.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.5.2") testImplementation("org.junit.jupiter:junit-jupiter:5.6.0")
} }
checkstyle { checkstyle {

@ -149,7 +149,7 @@ class TestFailuresPluginIntegrationTests {
writer.println("}"); writer.println("}");
writer.println(); writer.println();
writer.println("dependencies {"); writer.println("dependencies {");
writer.println(" testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'"); writer.println(" testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'");
writer.println(" testImplementation 'org.assertj:assertj-core:3.11.1'"); writer.println(" testImplementation 'org.assertj:assertj-core:3.11.1'");
writer.println("}"); writer.println("}");
writer.println(); writer.println();

@ -942,7 +942,7 @@ bom {
] ]
} }
} }
library("JUnit Jupiter", "5.5.2") { library("JUnit Jupiter", "5.6.0") {
group("org.junit") { group("org.junit") {
imports = [ imports = [
"junit-bom" "junit-bom"

@ -20,7 +20,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -41,7 +41,7 @@ class RunningDocumentationTests {
GradleBuild gradleBuild; GradleBuild gradleBuild;
@TestTemplate @TestTemplate
@DisabledOnJre(JRE.JAVA_13) @DisabledForJreRange(min = JRE.JAVA_13)
void bootRunMain() throws IOException { void bootRunMain() throws IOException {
// Testing of convention mappings is flakey between 5.2 and 6.0 inclusive // Testing of convention mappings is flakey between 5.2 and 6.0 inclusive
// https://github.com/gradle/gradle/issues/11323 // https://github.com/gradle/gradle/issues/11323

@ -21,7 +21,7 @@ import java.io.IOException;
import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.BuildResult;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -47,13 +47,13 @@ class SpringBootPluginIntegrationTests {
.contains("Spring Boot plugin requires Gradle 5.6 or later. The current version is Gradle 5.5.1"); .contains("Spring Boot plugin requires Gradle 5.6 or later. The current version is Gradle 5.5.1");
} }
@DisabledOnJre(JRE.JAVA_13) @DisabledForJreRange(min = JRE.JAVA_13)
@Test @Test
void succeedWithVersionOfGradleHigherThanRequired() { void succeedWithVersionOfGradleHigherThanRequired() {
this.gradleBuild.gradleVersion("5.6.1").build(); this.gradleBuild.gradleVersion("5.6.1").build();
} }
@DisabledOnJre(JRE.JAVA_13) @DisabledForJreRange(min = JRE.JAVA_13)
@Test @Test
void succeedWithVersionOfGradleMatchingWhatIsRequired() { void succeedWithVersionOfGradleMatchingWhatIsRequired() {
this.gradleBuild.gradleVersion("5.6").build(); this.gradleBuild.gradleVersion("5.6").build();

@ -16,10 +16,8 @@
package org.springframework.boot.testsupport.classpath; package org.springframework.boot.testsupport.classpath;
import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.Extension;
import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext;
@ -76,7 +74,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
invocation.proceed(); invocation.proceed();
return; return;
} }
fakeInvocation(invocation); invocation.skip();
runTestWithModifiedClassPath(invocationContext, extensionContext); runTestWithModifiedClassPath(invocationContext, extensionContext);
} }
@ -129,17 +127,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
invocation.proceed(); invocation.proceed();
return; return;
} }
fakeInvocation(invocation); invocation.skip();
}
private void fakeInvocation(Invocation<Void> invocation) {
try {
Field field = ReflectionUtils.findField(invocation.getClass(), "invoked");
ReflectionUtils.makeAccessible(field);
ReflectionUtils.setField(field, invocation, new AtomicBoolean(true));
}
catch (Throwable ex) {
}
} }
private boolean isModifiedClassPathClassLoader(ExtensionContext extensionContext) { private boolean isModifiedClassPathClassLoader(ExtensionContext extensionContext) {

Loading…
Cancel
Save