diff --git a/spring-core/spring-core.gradle b/spring-core/spring-core.gradle index 79dd105c9e0b..7e49806e0dc1 100644 --- a/spring-core/spring-core.gradle +++ b/spring-core/spring-core.gradle @@ -92,4 +92,10 @@ test { // Make sure the classes dir is used on the test classpath (required by ResourceTests). // When test fixtures are involved, the JAR is used by default. classpath = sourceSets.main.output.classesDirs + classpath - files(jar.archiveFile) + + // Ensure that BlockHound tests run on JDK 13+. For details, see: + // https://github.com/reactor/BlockHound/issues/33 + jvmArgs += [ + "-XX:+AllowRedefinitionToAddDeleteMethods" + ] } diff --git a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java index ea4b7fbbd552..370eb36a4569 100644 --- a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java +++ b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledForJreRange; import reactor.blockhound.BlockHound; import reactor.core.scheduler.ReactorBlockHoundIntegration; import reactor.core.scheduler.Schedulers; @@ -32,16 +31,23 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.condition.JRE.JAVA_14; /** * Tests to verify the spring-core BlockHound integration rules. * + *

NOTE: to run this test class in the IDE, you need to specify the following + * JVM argument. For details, see + * BlockHound issue 33. + * + *

+ * -XX:+AllowRedefinitionToAddDeleteMethods
+ * 
+ * * @author Rossen Stoyanchev + * @author Sam Brannen * @since 5.2.4 */ -@DisabledForJreRange(min = JAVA_14) -public class SpringCoreBlockHoundIntegrationTests { +class SpringCoreBlockHoundIntegrationTests { @BeforeAll @@ -64,7 +70,7 @@ void localVariableTableParameterNameDiscoverer() { testNonBlockingTask(() -> { Method setName = TestObject.class.getMethod("setName", String.class); String[] names = new LocalVariableTableParameterNameDiscoverer().getParameterNames(setName); - assertThat(names).isEqualTo(new String[] {"name"}); + assertThat(names).containsExactly("name"); }); }