-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Overview
@DisplayNameGeneration
is currently discovered on the current test, a superclass, or the enclosing class in which a Nested
test class is declared. However, the runtime type of an enclosing instance is not always the class in which a @Nested
test class is declared.
Example
The examples here are copies of those in #4130 except that @IndicativeSentencesGeneration
has been moved from AbstractBaseTests
to ScenarioOneTests
.
abstract class AbstractBaseTests {
@Nested
class NestedTests {
@Test
void test() {
}
}
}
@IndicativeSentencesGeneration
class ScenarioOneTests extends AbstractBaseTests {
}
Actual Behavior
When running ScenarioOneTests
, we currently see the following display names, since @IndicativeSentencesGeneration
is not honored (i.e., the @DisplayNameGeneration(IndicativeSentences.class)
meta-annotation is not discovered).
ScenarioOneTests
NestedTests
test()
Expected Behavior
When running ScenarioOneTests
, we would expect the following display names before #4130 is resolved.
ScenarioOneTests
AbstractBaseTests, NestedTests
AbstractBaseTests, NestedTests, test()
When running ScenarioOneTests
, we would expect the following display names after #4130 is resolved.
ScenarioOneTests
ScenarioOneTests, NestedTests
ScenarioOneTests, NestedTests, test()
Related Issues
Deliverables
- Determine if it is possible to support this use case
- If it is possible, ensure that
@DisplayNameGeneration
is discovered on the runtime enclosing type for a@Nested
test class.