Description
This is a follow-up to #27285 to ensure that users can "disable" class-level execution phase scripts and statements that would otherwise be inherited in a @Nested
test class.
Commits b98b999 and d1b4338 introduced tests for the status quo for @Sql
scripts/statements inherited from the enclosing class of a @Nested
test class.
Those tests pass; however, if you change "recreate-schema.sql"
to "schema.sql"
in the class-level @Sql
declarations on those enclosing test classes, the @Nested
test classes will then fail since the class-level execution phase scripts/statements are executed for the enclosing class and then again for each @Nested
class, which is probably not what the user intends.
Method-level @Sql
declarations can already be configured to override or merge with class-level @Sql
declarations via @SqlMergeMode
. So we might be able to "disable" class-level execution phase scripts and statements by introducing additional enum constants in SqlMergeMode.MergeMode
, or we may need to introduce some form of boolean inheritClassLevelExecutionPhases
flag.
In summary, I think we need a way for a @Nested
test class (or a subclass of a test class) to disable inheritance of class-level execution phase scripts/statements, but the nature of how this will be "disabled" is yet to be determined.
Activity