-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@DisplayNameGeneration
is not discovered on runtime enclosing type for @Nested
test class
#4131
Comments
Team decision: Investigate feasibility after #4130 has been addressed. |
hello @sbrannen, I would love to work on this issue, would you please assign it to me? |
@abdelmawla56 I'd be happy to but #4130 should be done first because we think there'll be a large overlap. That's why this issue is currently labeled as "blocked". |
This change is leading to deprecation warnings when upgrading as we're relying on Looking at ed68831, it looks like it has been introduced for a very specific feature, which came a bit as a surprise to me. Our use case is to find an annotation that can be specified on a Given that |
Thanks for bringing this up, @snicoll. We'll discuss this within the team. |
I searched the Spring Boot code base and discovered the recently introduced @snicoll, can you please confirm that's the use case you are talking about? Thanks |
Yes, that's where we noticed the deprecation. I would have liked to use the search capabilities here as well but, IIRC, couldn't do so as we're looking for a repeatable annotation there. We've struggled with supporting the semantics of |
Team decision: Introduce |
Thank you! |
Overview
@DisplayNameGeneration
is currently discovered on the current test, a superclass, or the enclosing class in which aNested
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 fromAbstractBaseTests
toScenarioOneTests
.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
DisplayNameGenerator
cannot access runtime enclosing type for@Nested
test class #4130Deliverables
@DisplayNameGeneration
is discovered on the runtime enclosing type for a@Nested
test class.The text was updated successfully, but these errors were encountered: