From b98b9999973637f72ee7734a9369db97ee3344a3 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 8 Oct 2023 18:07:59 +0200 Subject: [PATCH] =?UTF-8?q?Test=20status=20quo=20for=20inherited=20@?= =?UTF-8?q?=E2=81=A0Sql=20in=20@=E2=81=A0Nested=20test=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jdbc/TransactionalSqlScriptsTests.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java b/spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java index bba80aec14..28cc57235e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java @@ -17,6 +17,7 @@ package org.springframework.test.context.jdbc; import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -31,7 +32,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; */ @SpringJUnitConfig(EmptyDatabaseConfig.class) @TestMethodOrder(MethodOrderer.MethodName.class) -@Sql({ "schema.sql", "data.sql" }) +@Sql({ "recreate-schema.sql", "data.sql" }) @DirtiesContext class TransactionalSqlScriptsTests extends AbstractTransactionalTests { @@ -46,4 +47,20 @@ class TransactionalSqlScriptsTests extends AbstractTransactionalTests { assertNumUsers(2); } + @Nested + class NestedTransactionalSqlScriptsTests { + + @Test + void classLevelScripts() { + assertNumUsers(1); + } + + @Test + @Sql({ "recreate-schema.sql", "data.sql", "data-add-dogbert.sql" }) + void methodLevelScripts() { + assertNumUsers(2); + } + + } + }