Repository: micronaut-projects/micronaut-test (java)

Issue:
JUnit Engine should be managed
### Feature description

There's an inconsistency in how we handle the test frameworks. With kotest, we can use:

```kotlin
    testImplementation(mnTest.micronaut.test.kotest5)
    testRuntimeOnly(mnTest.kotest.runner.junit5.jvm)
```

To get the JUnit5 runtime dependency. But we have no such thing for JUnit, which forces to declare a dependency:

```kotlin
    testImplementation(mnTest.micronaut.test.junit5)
    testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.2")
```

Note that this is in a `test-suite` project, not a user project which would apply the Micronaut Gradle plugin, but still, for consistency and users wanting to avoid our plugins, there should be a managed version of JUnit.


Pull request description:
Move junit libs to managed block.
Fixed #831

Patch:
diff --git a/.github/workflows/graalvm-dev.yml b/.github/workflows/graalvm-dev.yml
index ecd870d6..03cb77a9 100644
--- a/.github/workflows/graalvm-dev.yml
+++ b/.github/workflows/graalvm-dev.yml
@@ -28,7 +28,13 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       max-parallel: 6
-      matrix: ${{ fromJson(needs.build_matrix.outputs.matrix) }}
+      matrix:
+        java: ['dev']
+        distribution: ['graalvm-community']
+        native_test_task: ${{ fromJson(needs.build_matrix.outputs.matrix).native_test_task }}
+        include:
+          - java: '22-ea'
+            distribution: 'graalvm'
     env:
       GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
       GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
@@ -39,7 +45,8 @@ jobs:
         uses: micronaut-projects/github-actions/graalvm/pre-build@master
         id: pre-build
         with:
-          java: 'dev'
+          java: ${{ matrix.java }}
+          distribution: ${{ matrix.distribution }}
       - name: Build Steps
         uses: micronaut-projects/github-actions/graalvm/build@master
         id: build
@@ -53,4 +60,4 @@ jobs:
         uses: micronaut-projects/github-actions/graalvm/post-build@master
         id: post-build
         with:
-          java: 'dev'
+          java: ${{ matrix.java }}
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 9b157ff9..8ca81050 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -45,7 +45,7 @@ jobs:
           fetch-depth: 0
 
       - name: "🔧 Setup GraalVM CE"
-        uses: graalvm/setup-graalvm@v1.1.6
+        uses: graalvm/setup-graalvm@v1.1.7
         with:
           distribution: 'graalvm'
           java-version: ${{ matrix.java }}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 51c64c1c..8cdb9b8a 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,14 +1,14 @@
 [versions]
-micronaut = "4.3.5"
-micronaut-platform = "4.3.1"
+micronaut = "4.3.7"
+micronaut-platform = "4.3.2"
 micronaut-docs = "2.0.0"
 groovy = "4.0.15"
 
-managed-assertj = "3.25.1"
+managed-assertj = "3.25.3"
 managed-hamcrest = "2.2"
-managed-mockito = "5.9.0"
+managed-mockito = "5.10.0"
 managed-mockk = "1.13.9"
-managed-junit = "5.10.1"
+managed-junit = "5.10.2"
 managed-rest-assured = "5.4.0"
 managed-kotest = "5.8.0"
 managed-spock = "2.3-groovy-4.0"
@@ -16,14 +16,14 @@ managed-spock = "2.3-groovy-4.0"
 kotlin = "1.9.22"
 graal-svm = "23.1.2"
 
-micronaut-test = "4.2.0"
-micronaut-data = "4.4.1"
+micronaut-test = "4.2.1"
+micronaut-data = "4.6.2"
 micronaut-hibernate-validator = "4.2.0"
 micronaut-logging = "1.1.2"
-micronaut-r2dbc = "5.2.0"
-micronaut-serde = "2.7.0"
+micronaut-r2dbc = "5.3.0"
+micronaut-serde = "2.8.1"
 micronaut-spring = "5.4.1"
-micronaut-sql = "5.4.0"
+micronaut-sql = "5.5.1"
 micronaut-reactor = "3.2.1"
 micronaut-test-resources = "2.3.3"
 
@@ -53,6 +53,11 @@ managed-mockk = { module = "io.mockk:mockk", version.ref = "managed-mockk" }
 managed-kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "managed-kotest" }
 managed-kotest-runner-junit5-jvm = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "managed-kotest" }
 
+managed-junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "managed-junit" }
+managed-junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "managed-junit" }
+managed-junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "managed-junit" }
+managed-junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "managed-junit" }
+
 # BOMs
 boms-junit = { module = "org.junit:junit-bom", version.ref = "managed-junit" }
 boms-kotest = { module = "io.kotest:kotest-bom", version.ref = "managed-kotest" }
@@ -65,9 +70,6 @@ graal-svm = { module = "org.graalvm.nativeimage:svm", version.ref = "graal-svm"
 
 spock-core = { module = "org.spockframework:spock-core" }
 jakarta-inject-api = { module = "jakarta.inject:jakarta.inject-api" }
-junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "managed-junit" }
-junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "managed-junit" }
-junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "managed-junit" }
 rest-assured = { module = "io.rest-assured:rest-assured" }
 kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
 kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }


Test patch:
diff --git a/test-core/build.gradle b/test-core/build.gradle
index 4473256d..c820dddc 100644
--- a/test-core/build.gradle
+++ b/test-core/build.gradle
@@ -5,7 +5,7 @@ plugins {
 
 dependencies {
     compileOnly(mn.micronaut.http.server)
-    compileOnly(libs.junit.jupiter.api)
+    compileOnly(libs.managed.junit.jupiter.api)
     compileOnly(mnData.micronaut.data.connection.jdbc)
     compileOnly(mnR2dbc.r2dbc.spi)
     compileOnly(mn.reactor)
diff --git a/test-core/src/main/java/io/micronaut/test/extensions/AbstractMicronautExtension.java b/test-core/src/main/java/io/micronaut/test/extensions/AbstractMicronautExtension.java
index ad7f239f..aed722cf 100644
--- a/test-core/src/main/java/io/micronaut/test/extensions/AbstractMicronautExtension.java
+++ b/test-core/src/main/java/io/micronaut/test/extensions/AbstractMicronautExtension.java
@@ -74,7 +74,12 @@ public abstract class AbstractMicronautExtension<C> implements TestExecutionList
     public static final String TEST_TRANSACTIONAL = "micronaut.test.transactional";
     public static final String TEST_TRANSACTION_MODE = "micronaut.test.transaction-mode";
     public static final String DISABLED_MESSAGE = "Test is not bean. Either the test does not satisfy requirements defined by @Requires or annotation processing is not enabled. If the latter ensure annotation processing is enabled in your IDE.";
-    public static final String MISCONFIGURED_MESSAGE = "@MicronautTest used on test but no bean definition for the test present. This error indicates a misconfigured build or IDE. Please add the 'micronaut-inject-java' annotation processor to your test processor path (for Java this is the testAnnotationProcessor scope, for Kotlin kaptTest and for Groovy testCompile). See the documentation for reference: https://micronaut-projects.github.io/micronaut-test/latest/guide/";
+    public static final String MISCONFIGURED_MESSAGE = """
+        @MicronautTest used on test but no bean definition for the test present. \
+        This error indicates a misconfigured build or IDE. \
+        Please check 'micronaut.processing.group' or 'micronaut.processing.annotations' in your build. \
+        Add the 'micronaut-inject-java' annotation processor to your test processor path (for Java this is the testAnnotationProcessor scope, for Kotlin kaptTest and for Groovy testCompile). \
+        See the documentation for reference: https://micronaut-projects.github.io/micronaut-test/latest/guide/""";
     /**
      * The name of the property source that contains test properties.
      */
diff --git a/test-core/src/main/java/io/micronaut/test/support/sql/TestSqlAnnotationHandler.java b/test-core/src/main/java/io/micronaut/test/support/sql/TestSqlAnnotationHandler.java
index eadf5c81..4417f55b 100644
--- a/test-core/src/main/java/io/micronaut/test/support/sql/TestSqlAnnotationHandler.java
+++ b/test-core/src/main/java/io/micronaut/test/support/sql/TestSqlAnnotationHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017-2023 original authors
+ * Copyright 2017-2024 original authors
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -63,27 +63,37 @@ public final class TestSqlAnnotationHandler {
      * @throws IOException If an error occurs reading the SQL
      */
     public static void handle(BeanDefinition<?> specDefinition, ApplicationContext applicationContext, Sql.Phase phase) throws IOException {
-        ResourceLoader resourceLoader = applicationContext.getBean(ResourceLoader.class);
         Optional<List<AnnotationValue<Sql>>> sqlAnnotations = specDefinition
             .findAnnotation(Sql.Sqls.class)
             .map(s -> s.getAnnotations("value", Sql.class));
 
         if (sqlAnnotations.isPresent()) {
-            for (var sql : sqlAnnotations.get()) {
-                if (sql.getRequiredValue("phase", Sql.Phase.class) != phase) {
-                    continue;
-                }
-                List<@NonNull String> scripts = Arrays.asList(sql.stringValues());
-                if (!scripts.isEmpty()) {
-                    Consumer<String> proc = bean(
-                        sql.getRequiredValue("resourceType", Class.class),
-                        sql.getRequiredValue("dataSourceName", String.class),
-                        applicationContext
-                    );
-                    handleScript(resourceLoader, scripts, proc, phase);
-                } else if (LOG.isTraceEnabled()) {
-                    LOG.trace("No SQL scripts found for {} phase", phase);
+            if (!applicationContext.isRunning()) {
+                if (LOG.isWarnEnabled()) {
+                    LOG.warn("Application context has been stopped, skipping SQL script annotations");
                 }
+            } else {
+                processAnnotations(applicationContext, phase, sqlAnnotations.get());
+            }
+        }
+    }
+
+    private static void processAnnotations(ApplicationContext applicationContext, Sql.Phase phase, List<AnnotationValue<Sql>> sqlAnnotations) throws IOException {
+        ResourceLoader resourceLoader = applicationContext.getBean(ResourceLoader.class);
+        for (var sql : sqlAnnotations) {
+            if (sql.getRequiredValue("phase", Sql.Phase.class) != phase) {
+                continue;
+            }
+            List<@NonNull String> scripts = Arrays.asList(sql.stringValues());
+            if (!scripts.isEmpty()) {
+                Consumer<String> proc = bean(
+                    sql.getRequiredValue("resourceType", Class.class),
+                    sql.getRequiredValue("dataSourceName", String.class),
+                    applicationContext
+                );
+                handleScript(resourceLoader, scripts, proc, phase);
+            } else if (LOG.isTraceEnabled()) {
+                LOG.trace("No SQL scripts found for {} phase", phase);
             }
         }
     }
@@ -111,5 +121,4 @@ public final class TestSqlAnnotationHandler {
             }
         }
     }
-
 }
diff --git a/test-junit5/build.gradle b/test-junit5/build.gradle
index 9b9e1b02..aac010e4 100644
--- a/test-junit5/build.gradle
+++ b/test-junit5/build.gradle
@@ -34,18 +34,21 @@ tasks.withType(Jar).configureEach {
 }
 
 dependencies {
+
+    compileOnly(libs.graal.svm)
+
     api projects.micronautTestCore
     api(mn.micronaut.inject)
-    api(libs.junit.jupiter.api)
+    api(libs.managed.junit.jupiter.api)
+
     implementation(mn.micronaut.context)
-    compileOnly(libs.graal.svm)
 
     testCompileOnly(mn.micronaut.inject)
 
     testAnnotationProcessor(mn.micronaut.inject.java)
     testAnnotationProcessor(mn.micronaut.graal)
 
-    testImplementation(libs.junit.jupiter.params)
+    testImplementation(libs.managed.junit.jupiter.params)
     testImplementation(mn.micronaut.http.server.netty)
     testImplementation(mn.micronaut.http.client)
     testImplementation(libs.managed.mockito.junit.jupiter)
@@ -58,7 +61,7 @@ dependencies {
     testRuntimeOnly(mnSql.micronaut.jdbc.tomcat)
     testRuntimeOnly(mnSql.h2)
     testRuntimeOnly(mnSerde.micronaut.serde.jackson)
-    testRuntimeOnly(libs.junit.jupiter.engine)
+    testRuntimeOnly(libs.managed.junit.jupiter.engine)
     testRuntimeOnly(testFixtures(projects.micronautTestCore))
 }
 
diff --git a/test-junit5/src/test/java/io/micronaut/test/junit5/ApplicationStopTest.java b/test-junit5/src/test/java/io/micronaut/test/junit5/ApplicationStopTest.java
new file mode 100644
index 00000000..86b33586
--- /dev/null
+++ b/test-junit5/src/test/java/io/micronaut/test/junit5/ApplicationStopTest.java
@@ -0,0 +1,27 @@
+package io.micronaut.test.junit5;
+
+import io.micronaut.context.ApplicationContext;
+import io.micronaut.runtime.EmbeddedApplication;
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import jakarta.inject.Inject;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@MicronautTest
+class ApplicationStopTest {
+
+    @Inject
+    private ApplicationContext applicationContext;
+
+    @Test
+    void stoppingTheContextDoesntCauseFailures() {
+        applicationContext.stop();
+        assertTrue(true);
+        // should not error
+    }
+}
diff --git a/test-junit5/src/test/java/io/micronaut/test/junit5/SqlDatasourceApplicationStopTest.java b/test-junit5/src/test/java/io/micronaut/test/junit5/SqlDatasourceApplicationStopTest.java
new file mode 100644
index 00000000..8efb7669
--- /dev/null
+++ b/test-junit5/src/test/java/io/micronaut/test/junit5/SqlDatasourceApplicationStopTest.java
@@ -0,0 +1,59 @@
+package io.micronaut.test.junit5;
+
+import io.micronaut.context.ApplicationContext;
+import io.micronaut.context.annotation.Property;
+import io.micronaut.test.annotation.Sql;
+import io.micronaut.test.annotation.TransactionMode;
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import jakarta.inject.Inject;
+import org.junit.jupiter.api.Test;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@DbProperties
+@MicronautTest(transactionMode = TransactionMode.SINGLE_TRANSACTION)
+@Property(name = "datasources.default.dialect", value = "H2")
+@Property(name = "datasources.default.driverClassName", value = "org.h2.Driver")
+@Property(name = "datasources.default.schema-generate", value = "CREATE_DROP")
+@Property(name = "datasources.default.url", value = "jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE")
+@Property(name = "datasources.default.username", value = "sa")
+@Sql({"classpath:create.sql", "classpath:datasource_1_insert.sql"}) // <1>
+class SqlDatasourceApplicationStopTest {
+
+    @Inject
+    ApplicationContext applicationContext;
+
+    @Inject
+    DataSource dataSource;
+
+    @Test
+    void stoppingTheContextDoesntCauseFailures() throws Exception {
+        assertEquals(List.of("Aardvark", "Albatross"), readAllNames(dataSource));
+        applicationContext.stop();
+        assertTrue(true);
+        // should not error
+    }
+
+    List<String> readAllNames(DataSource dataSource) throws SQLException {
+        var result = new ArrayList<String>();
+        try (
+                Connection ds = dataSource.getConnection();
+                PreparedStatement ps = ds.prepareStatement("select name from MyTable");
+                ResultSet rslt = ps.executeQuery()
+        ) {
+            while(rslt.next()) {
+                result.add(rslt.getString(1));
+            }
+        }
+        return result;
+    }
+}
diff --git a/test-kotest5/build.gradle b/test-kotest5/build.gradle
index d9e101a3..3d780707 100644
--- a/test-kotest5/build.gradle
+++ b/test-kotest5/build.gradle
@@ -5,6 +5,9 @@ plugins {
 }
 
 dependencies {
+
+    compileOnly(libs.jakarta.inject.api)
+
     api projects.micronautTestCore
     api(mn.micronaut.context)
     api(platform(libs.boms.kotest))
@@ -15,27 +18,23 @@ dependencies {
     implementation(libs.kotlin.stdlib.jdk8)
     implementation(libs.kotlin.reflect)
 
-    compileOnly(libs.jakarta.inject.api)
-
-    testCompileOnly(libs.jakarta.inject.api)
-
     kaptTest(platform(mn.micronaut.core.bom))
     kaptTest(mn.micronaut.inject.java)
 
-    testImplementation(libs.managed.mockk)
+    testCompileOnly(libs.jakarta.inject.api)
 
+    testImplementation(libs.managed.mockk)
     testImplementation(mn.micronaut.http.server.netty)
     testImplementation(mn.micronaut.http.client)
-
     testImplementation(mnData.micronaut.data.tx)
     testImplementation(mnData.micronaut.data.hibernate.jpa)
+    testImplementation(mn.snakeyaml)
+    testImplementation(libs.managed.kotest.assertions.core.jvm)
 
     testRuntimeOnly(mnLogging.logback.classic)
     testRuntimeOnly(mnSql.micronaut.jdbc.tomcat)
     testRuntimeOnly(mnSql.h2)
     testRuntimeOnly(mnSerde.micronaut.serde.jackson)
-    testImplementation(mn.snakeyaml)
-    testImplementation(libs.managed.kotest.assertions.core.jvm)
     testRuntimeOnly(testFixtures(projects.micronautTestCore))
 }
 
diff --git a/test-rest-assured/build.gradle b/test-rest-assured/build.gradle
index f66d9ccd..2cc1a9e6 100644
--- a/test-rest-assured/build.gradle
+++ b/test-rest-assured/build.gradle
@@ -4,6 +4,7 @@ plugins {
 
 dependencies {
     annotationProcessor(mn.micronaut.inject.java)
+
     api projects.micronautTestCore
     api(platform(libs.boms.rest.assured))
     api(mn.micronaut.inject)
@@ -11,15 +12,17 @@ dependencies {
         exclude group:"org.codehaus.groovy", module:"groovy"
     }
     implementation(mn.micronaut.context)
-
     implementation(libs.groovy)
-    testCompileOnly(mn.micronaut.inject)
 
     testAnnotationProcessor(mn.micronaut.inject.java)
-    testImplementation(libs.junit.jupiter.api)
+
+    testCompileOnly(mn.micronaut.inject)
+
+    testImplementation(libs.managed.junit.jupiter.api)
     testImplementation projects.micronautTestJunit5
     testImplementation(mn.micronaut.http.server.netty)
     testImplementation(libs.managed.hamcrest)
-    testRuntimeOnly(libs.junit.jupiter.engine)
+
+    testRuntimeOnly(libs.managed.junit.jupiter.engine)
     testRuntimeOnly(mnSerde.micronaut.serde.jackson)
 }
diff --git a/test-spock/build.gradle b/test-spock/build.gradle
index cefadcc2..333089de 100644
--- a/test-spock/build.gradle
+++ b/test-spock/build.gradle
@@ -3,23 +3,25 @@ plugins {
 }
 
 dependencies {
+
+    compileOnly(libs.jakarta.inject.api)
+
     api(platform(libs.boms.spock))
     api projects.micronautTestCore
     api(mn.micronaut.inject)
     api(libs.spock.core) {
         exclude group: "org.codehaus.groovy", module: "groovy-all"
     }
+
     implementation(mn.micronaut.context)
-    compileOnly(libs.jakarta.inject.api)
 
     testCompileOnly(libs.jakarta.inject.api)
+
     testImplementation(mn.micronaut.inject.groovy)
     testImplementation(mn.micronaut.http.server.netty)
     testImplementation(mn.micronaut.http.client)
-
     testImplementation(mnSql.micronaut.jdbc.hikari)
     testImplementation(libs.micronaut.hibernate.validator)
-//    testImplementation(mn.micronaut.hibernate.gorm)
     testImplementation(mnSpring.micronaut.spring)
     testImplementation(mn.snakeyaml)
     testImplementation(mnReactor.micronaut.reactor)
diff --git a/test-spock/src/main/java/io/micronaut/test/extensions/spock/MicronautSpockExtension.java b/test-spock/src/main/java/io/micronaut/test/extensions/spock/MicronautSpockExtension.java
index c86f1f53..0243dbd7 100644
--- a/test-spock/src/main/java/io/micronaut/test/extensions/spock/MicronautSpockExtension.java
+++ b/test-spock/src/main/java/io/micronaut/test/extensions/spock/MicronautSpockExtension.java
@@ -65,26 +65,11 @@ public class MicronautSpockExtension<T extends Annotation> extends AbstractMicro
 
         spec.getAllFeatures().forEach(feature -> {
 
-            feature.addInterceptor(invocation -> {
-                TestContext testContext = buildContext(invocation, null);
-                try {
-                    beforeTestMethod(testContext);
-                    interceptTest(new TestMethodInvocationContext<Object>() {
-                        @Override
-                        public TestContext getTestContext() {
-                            return testContext;
-                        }
-
-                        @Override
-                        public Object proceed() throws Throwable {
-                            invocation.proceed();
-                            return null;
-                        }
-                    });
-                } finally {
-                    afterTestMethod(testContext);
-                }
-            });
+            if (feature.isParameterized()) {
+                feature.addIterationInterceptor(this::getInvocationInterceptor);
+            } else {
+                feature.addInterceptor(this::getInvocationInterceptor);
+            }
 
             feature.getFeatureMethod().addInterceptor(invocation -> {
                 try {
@@ -198,6 +183,28 @@ public class MicronautSpockExtension<T extends Annotation> extends AbstractMicro
         });
     }
 
+    @SuppressWarnings("java:S112") // Throwable is what we deal with here
+    private void getInvocationInterceptor(IMethodInvocation invocation) throws Throwable {
+        TestContext testContext = buildContext(invocation, null);
+        try {
+            beforeTestMethod(testContext);
+            interceptTest(new TestMethodInvocationContext<Object>() {
+                @Override
+                public TestContext getTestContext() {
+                    return testContext;
+                }
+
+                @Override
+                public Object proceed() throws Throwable {
+                    invocation.proceed();
+                    return null;
+                }
+            });
+        } finally {
+            afterTestMethod(testContext);
+        }
+    }
+
     private MicronautTestValue buildValueObject(MicronautTest micronautTest) {
         if (micronautTest != null) {
             return new MicronautTestValue(
diff --git a/test-spock/src/test/groovy/io/micronaut/test/spock/intercept/InterceptTestSpec.groovy b/test-spock/src/test/groovy/io/micronaut/test/spock/intercept/InterceptTestSpec.groovy
index 39ae7d76..54b5028b 100644
--- a/test-spock/src/test/groovy/io/micronaut/test/spock/intercept/InterceptTestSpec.groovy
+++ b/test-spock/src/test/groovy/io/micronaut/test/spock/intercept/InterceptTestSpec.groovy
@@ -1,18 +1,3 @@
-/*
- * Copyright 2017-2020 original authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package io.micronaut.test.spock.intercept
 
 import io.micronaut.context.annotation.Property
@@ -21,7 +6,6 @@ import io.micronaut.test.spock.MathService
 import jakarta.inject.Inject
 import spock.lang.Specification
 import spock.lang.Stepwise
-import spock.lang.Unroll
 
 @Stepwise
 @MicronautTest
@@ -34,7 +18,6 @@ class InterceptTestSpec extends Specification {
     @Inject
     TestInterceptor testInterceptor
 
-    @Unroll
     void "should compute #num to #expected"() {
         when:
             def result = mathService.compute(num)
@@ -62,6 +45,8 @@ class InterceptTestSpec extends Specification {
                     'OUT BEFORE $spock_feature_0_0',
                     'IN AFTER $spock_feature_0_0',
                     'OUT AFTER $spock_feature_0_0',
+                    'OUT $spock_feature_0_0', // This is the implicit unroll
+                    'IN $spock_feature_0_0',
                     'IN BEFORE $spock_feature_0_0',
                     'OUT BEFORE $spock_feature_0_0',
                     'IN AFTER $spock_feature_0_0',
@@ -80,13 +65,8 @@ class InterceptTestSpec extends Specification {
                     'OUT BEFORE $spock_feature_0_2',
                     //  This test is $spock_feature_0_2
             ]
+
         then:
-            assert calls.size() == expected.size()
-            for (int i = 0; i < expected.size(); i++) {
-                def a = calls.get(i)
-                def b = expected[i]
-                assert a == b
-            }
+            calls == expected
     }
-
 }
diff --git a/test-suite-at-sql-jpa/build.gradle.kts b/test-suite-at-sql-jpa/build.gradle.kts
index b2f01bfa..e9b52047 100644
--- a/test-suite-at-sql-jpa/build.gradle.kts
+++ b/test-suite-at-sql-jpa/build.gradle.kts
@@ -8,21 +8,22 @@ repositories {
 
 dependencies {
     annotationProcessor(mn.micronaut.inject.java)
-    testAnnotationProcessor(mn.micronaut.inject.java)
-
     annotationProcessor(mnData.micronaut.data.processor)
+
     implementation(mnData.micronaut.data.hibernate.jpa)
     implementation(mnSql.micronaut.jdbc.hikari)
-    runtimeOnly(mnSql.postgresql)
 
+    runtimeOnly(mnSql.postgresql)
     runtimeOnly(mnLogging.logback.classic)
 
-    testImplementation(libs.junit.jupiter.api)
-    testImplementation(projects.micronautTestJunit5)
-    testRuntimeOnly(libs.junit.jupiter.engine)
+    testAnnotationProcessor(mn.micronaut.inject.java)
 
+    testImplementation(libs.managed.junit.jupiter.api)
+    testImplementation(projects.micronautTestJunit5)
     testImplementation(mnTestResources.testcontainers.postgres)
+    testRuntimeOnly(libs.managed.junit.jupiter.engine)
 }
+
 tasks.withType<Test> {
     useJUnitPlatform()
 }