Test status quo for inherited @⁠Sql in @⁠Nested test class

This commit is contained in:
Sam Brannen
2023-10-08 18:07:59 +02:00
parent af4652db36
commit b98b999997

View File

@@ -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);
}
}
}