Browse Source

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

pull/31380/head
Sam Brannen 1 year ago
parent
commit
b98b999997
  1. 19
      spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java

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

@ -17,6 +17,7 @@ @@ -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; @@ -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 { @@ -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);
}
}
}

Loading…
Cancel
Save