Skip to content
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

Display names must not be allowed to be blank #743

Closed
4 tasks done
sbrannen opened this issue Mar 20, 2017 · 3 comments
Closed
4 tasks done

Display names must not be allowed to be blank #743

sbrannen opened this issue Mar 20, 2017 · 3 comments

Comments

@sbrannen
Copy link
Member

sbrannen commented Mar 20, 2017

Status Quo

It is currently possible to declare @DisplayName("") (or containing only white space), but this should not be permitted.

If a user explicitly declares @DisplayName, the user must provide a non-empty name.

The same applies to display name patterns supplied via @RepeatedTest and @ParameterizedTest.

Related Issues

Deliverables

  • Introduce appropriate JavaDoc for DisplayName.value.
  • ❌ Introduce precondition check to ensure that a user has supplied a non-empty name via @DisplayName.
    • See TODO in TestInfoParameterResolverTests.customDisplayNameThatIsEmpty()
    • Instead of using precondition checks, we can currently only log a warning. See commit f03cc6d for details.
  • Ensure that the precondition check is applied to @Test, @TestFactory, and @TestTemplate methods (for repeated and parameterized tests as well).
  • Ensure that all extensions or internal mechanisms that generate or return a display name return non-empty values.
@sbrannen
Copy link
Member Author

Tentatively slated for M4 since this is a bug, but if time constraints are an issue this can be moved to M5.

sbrannen added a commit that referenced this issue Mar 20, 2017
This commit introduces a test with an empty, custom display name which
should not be permitted.

Issue: #743
@sbrannen
Copy link
Member Author

in progress

@sbrannen sbrannen changed the title @DisplayName must not be allowed to be empty Display names must not be allowed to be blank Mar 23, 2017
sbrannen added a commit that referenced this issue Mar 23, 2017
Prior to this commit, the "not blank" precondition for display names
was not consistently enforced.

This commit addresses this issue by documenting that custom displays
names supplied via @DisplayName, @RepeatedTest, and @ParameterizedTest
are never permitted to be blank. Furthermore, the respective handling
of each of these annotations has been updated to log a warning if a
blank display name (or display name pattern) has been supplied by the
user.

At this point in time, it is unfortunately not possible to enforce such
preconditions with an explicit check using Preconditions.isNotBlank()
since we do not have a proper mechanism for handling such configuration
exceptions during the TestEngine discovery phase.

Issue: #743
@sbrannen
Copy link
Member Author

Fixed in f03cc6d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant