Skip to content

Commit b98b999

Browse files
committed
Test status quo for inherited @⁠Sql in @⁠Nested test class
1 parent af4652d commit b98b999

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.test.context.jdbc;
1818

1919
import org.junit.jupiter.api.MethodOrderer;
20+
import org.junit.jupiter.api.Nested;
2021
import org.junit.jupiter.api.Test;
2122
import org.junit.jupiter.api.TestMethodOrder;
2223

@@ -31,7 +32,7 @@
3132
*/
3233
@SpringJUnitConfig(EmptyDatabaseConfig.class)
3334
@TestMethodOrder(MethodOrderer.MethodName.class)
34-
@Sql({ "schema.sql", "data.sql" })
35+
@Sql({ "recreate-schema.sql", "data.sql" })
3536
@DirtiesContext
3637
class TransactionalSqlScriptsTests extends AbstractTransactionalTests {
3738

@@ -46,4 +47,20 @@ void methodLevelScripts() {
4647
assertNumUsers(2);
4748
}
4849

50+
@Nested
51+
class NestedTransactionalSqlScriptsTests {
52+
53+
@Test
54+
void classLevelScripts() {
55+
assertNumUsers(1);
56+
}
57+
58+
@Test
59+
@Sql({ "recreate-schema.sql", "data.sql", "data-add-dogbert.sql" })
60+
void methodLevelScripts() {
61+
assertNumUsers(2);
62+
}
63+
64+
}
65+
4966
}

0 commit comments

Comments
 (0)