-
-
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
Do not parse {displayName}
placeholder for @ParameterizedTest
using MessageFormat
#3264
Do not parse {displayName}
placeholder for @ParameterizedTest
using MessageFormat
#3264
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting the PR.
I've requested a few minor changes.
After making those changes, please add an entry in the Release Notes.
junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java
Outdated
Show resolved
Hide resolved
junit-jupiter-params/src/test/kotlin/ParameterizedTestNameFormatterIntegrationTests.kt
Outdated
Show resolved
Hide resolved
junit-jupiter-params/src/test/kotlin/ParameterizedTestNameFormatterIntegrationTests.kt
Outdated
Show resolved
Hide resolved
junit-jupiter-params/src/test/kotlin/ParameterizedTestNameFormatterIntegrationTests.kt
Outdated
Show resolved
Hide resolved
@sbrannen Sure I'll get to work on these changes. Should the Release Notes entry include the basic change? Something like "Bug Fix: |
@sbrannen Also, should the new constant be inside the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the previously requested changes.
I've requested a few additional changes after the latest review.
junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java
Outdated
Show resolved
Hide resolved
...piter-params/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java
Outdated
Show resolved
Hide resolved
junit-jupiter-params/src/test/kotlin/ParameterizedTestNameFormatterIntegrationTests.kt
Outdated
Show resolved
Hide resolved
junit-jupiter-params/src/test/kotlin/ParameterizedTestNameFormatterIntegrationTests.kt
Outdated
Show resolved
Hide resolved
FYI: changes to the Javadoc and User Guide are not needed for this change, so I've updated the Definition of Done accordingly. |
It's good as a private constant in |
There's no need to prefix it with "Bug Fix:". There's a dedicated section for bug fixes in JUnit Jupiter. Regarding the content, it should be more generic in nature, explaining that the See what you come up with, and if we deem it necessary we will polish the wording when merging the PR. |
@sbrannen Thanks for reviewing, I'll get to work on the changes and the release notes entry :) |
…e, Add new unit test and Add static keyword to new placeholder
{displayName}
placeholder for @ParameterizedTest
using MessageFormat
Prior to this commit, if a @ParameterizedTest used the {displayName} placeholder to generate a display name and the value of the displayName contained an apostrophe (') or something resembling a MessageFormat element (such as {data}), JUnit threw an exception due to failure to parse the display name. This is applicable to method names in Kotlin-based tests or custom display names in general. To fix this bug, instead of replacing the DISPLAY_NAME_PLACEHOLDER before the MessageFormat is evaluated, the DISPLAY_NAME_PLACEHOLDER is now replaced with another temporary placeholder, which is then replaced after the MessageFormat has been evaluated. Closes #3235 Closes #3264
Thank you! |
Overview
The
@ParameterizedTest
annotation was breaking name generation by not allowing'
in the method names for Kotlin-based tests or in custom display names in geneeral. It also made it so that placeholders were not being replaced correctly.To solve it, instead of replacing the
DISPLAY_NAME_PLACEHOLDER
before theMessageFormat
was being evaluated, theDISPLAY_NAME_PLACEHOLDER
is now replaced with another temporary placeholder, which is then replaced after theMessageFormat
is evaluated.Solves: #3235
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done