From 7f3d39ddd982c8838f4ea40b1b3e6b3964d86b04 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 21 Aug 2024 15:06:06 +0200 Subject: [PATCH] Enable Tests using VirtualThreads for java 21 onwards. This commit updates tests using virtual threads to run for java versions 21+. See: #665 --- .../example/springdata/jpa/simple/VirtualThreadsTests.java | 4 ++-- .../example/springdata/redis/PubSubVirtualThreadsTests.java | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jpa/example/src/test/java/example/springdata/jpa/simple/VirtualThreadsTests.java b/jpa/example/src/test/java/example/springdata/jpa/simple/VirtualThreadsTests.java index af581aa3f..915d2131d 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/simple/VirtualThreadsTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/simple/VirtualThreadsTests.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledOnJre; +import org.junit.jupiter.api.condition.EnabledForJreRange; import org.junit.jupiter.api.condition.JRE; import org.springframework.beans.factory.annotation.Autowired; @@ -41,7 +41,7 @@ */ @Transactional @SpringBootTest(properties = "spring.threads.virtual.enabled=true") -@EnabledOnJre(JRE.JAVA_21) +@EnabledForJreRange(min = JRE.JAVA_21) class VirtualThreadsTests { @Autowired SimpleUserRepository repository; diff --git a/redis/pubsub/src/test/java/example/springdata/redis/PubSubVirtualThreadsTests.java b/redis/pubsub/src/test/java/example/springdata/redis/PubSubVirtualThreadsTests.java index 8c4b7d603..5782868c4 100644 --- a/redis/pubsub/src/test/java/example/springdata/redis/PubSubVirtualThreadsTests.java +++ b/redis/pubsub/src/test/java/example/springdata/redis/PubSubVirtualThreadsTests.java @@ -22,9 +22,8 @@ import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledOnJre; +import org.junit.jupiter.api.condition.EnabledForJreRange; import org.junit.jupiter.api.condition.JRE; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.core.task.AsyncTaskExecutor; @@ -39,7 +38,7 @@ * @author Mark Paluch */ @SpringBootTest(properties = "spring.threads.virtual.enabled=true") -@EnabledOnJre(JRE.JAVA_21) +@EnabledForJreRange(min = JRE.JAVA_21) public class PubSubVirtualThreadsTests { @Autowired RedisConnectionFactory connectionFactory;