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

Align implementation of getLegacyReportingName() for test templates with specification in TestDescriptor #4269

Closed
wants to merge 1 commit into from

Conversation

alitokmen
Copy link

Overview

As per https://junit.org/junit5/docs/5.0.1/api/org/junit/platform/engine/TestDescriptor.html#getLegacyReportingName-- the default getLegacyReportingName is expected to use getDisplayName.

Aligning the definition accordingly, the current implementation instead always forces a [0], [1], ... at the end.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

As per https://junit.org/junit5/docs/5.0.1/api/org/junit/platform/engine/TestDescriptor.html#getLegacyReportingName-- the default getLegacyReportingName is expected to use getDisplayName.

Aligning the definition accordingly, the current implementation instead always forces a [0], [1], ... at the end.
@sormuras
Copy link
Member

The default implementation in TestDescriptor does as specified:

/**
* Get the name of this descriptor in a format that is suitable for legacy
* reporting infrastructure — for example, for reporting systems built
* on the Ant-based XML reporting format for JUnit 4.
*
* <p>The default implementation delegates to {@link #getDisplayName()}.
*
* @return the legacy reporting name; never {@code null} or blank
*/
default String getLegacyReportingName() {
return getDisplayName();
}

The Jupiter implementation overrides this by always forcing "a [0], [1], ... at the end." Working as specified, right? Or is the wording misleading?

@alitokmen
Copy link
Author

Thanks @sormuras the way I understood the specification was that it is expected to be overridable through getDisplayName.

Now that I see sooooo many failing tests, I have doubts whether to change the existing. I'm happy to drop it too.

@sbrannen
Copy link
Member

Thanks @sormuras the way I understood the specification was that it is expected to be overridable through getDisplayName.

The specification states the following.

Get the name of this descriptor in a format that is suitable for legacy reporting infrastructure — for example, for reporting systems built on the Ant-based XML reporting format for JUnit 4.

The default implementation simply delegates to getDisplayName().

That last sentence merely states how the interface default method is implemented.

It does not state that other implementations must delegate to getDisplayName().

Thus, other implementations are free to implement getLegacyReportingName() as they see fit.

Now that I see sooooo many failing tests, I have doubts whether to change the existing. I'm happy to drop it too.

OK. I'm closing this PR.

@sbrannen sbrannen closed this Jan 27, 2025
@sbrannen sbrannen changed the title Aligning the getLegacyReportingName definition with getDisplayName Align implementation of getLegacyReportingName() for test templates with specification in TestDescriptor Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants