-
-
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
Introduce @SentenceFragment
for use with IndicativeSentences
DisplayNameGenerator
#4347
Closed
1 task done
Comments
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Feb 26, 2025
6 tasks
6 tasks
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Feb 27, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Feb 27, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Feb 27, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Feb 27, 2025
This comment has been minimized.
This comment has been minimized.
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
sbrannen
added a commit
to sbrannen/junit5
that referenced
this issue
Mar 2, 2025
Prior to this commit, it was not possible to provide a custom display name for an individual "sentence fragment" for the IndicativeSentences DisplayNameGenerator. Although it is possible to register a custom DisplayNameGenerator (such as ReplaceUnderscores) to affect how a sentence fragment is generated, you previously could not provide an entire custom sentence fragment. In addition, attempting to use @DisplayName for a sentence fragment results in the entire sentence (that would otherwise be generated by the IndicativeSentences DisplayNameGenerator) getting overridden by the value of the @DisplayName for the current test class or test method. To address that shortcoming, this commit introduces a new @SentenceFragment annotation that can be used to specify custom sentence fragments when using the IndicativeSentences DisplayNameGenerator. Closes junit-team#4347 Closes junit-team#4349
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
While updating the Spring Framework test suite after the fixes for #4130 and #4131, I noticed that it's currently not possible to provide a custom display name for a "sentence fragment" for the
IndicativeSentences
DisplayNameGenerator
.You can of course register a custom
DisplayNameGenerator
(such asReplaceUnderscores
) to affect how a sentence fragment is generated, but you cannot provide a custom sentence fragment.If you attempt to use
@DisplayName
for a sentence fragment, the entire sentence (that would otherwise be generated by theIndicativeSentences
DisplayNameGenerator
) gets overridden by the value of the@DisplayName
.As a proof of concept, I implemented
@SentenceFragment
and a correspondingSentenceFragmentDisplayNameGenerator
) in this commit for Spring Framework's test suite.Deliverables
@SentenceFragment
directly inIndicativeSentences
.The text was updated successfully, but these errors were encountered: