Skip to content

Stop adding $ as "terminators" when filtering tests for JUnit 5 #7080

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

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

joca-bt
Copy link
Contributor

@joca-bt joca-bt commented Nov 29, 2024

While $ may be useful in other JUnit versions to determine where a "class boundary" ends, as the plugin is using , for enumeration in that case (i.e. mypackage.myClass1#myMethod1,myMethod2$|...), it is not needed when the enumeration is between () as in JUnit5 (i.e. mypackage.myClass1#(myMethod1|myMethod2)|...).

Checklist

  • I have filed an issue about this change and discussed potential changes with the maintainers.
  • I have received the approval from the maintainers to make this change.
  • This is not a stylistic, refactoring, or cleanup change.

Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See
the Contributions section in the README for more
details.

Discussion thread for this change

Issue number: #7061

Description of this change

@github-actions github-actions bot added product: IntelliJ IntelliJ plugin awaiting-review Awaiting review from Bazel team on PRs labels Nov 29, 2024
@joca-bt
Copy link
Contributor Author

joca-bt commented Jan 8, 2025

@tpasternak could someone have a look at this as a follow up to #7060 and #7061?

@tpasternak
Copy link
Contributor

Sorry I'm out of the project for a few weeks already. Cc@sellophane

@mai93 mai93 requested review from sellophane and removed request for tpasternak January 8, 2025 18:20
Copy link
Collaborator

@odisseus odisseus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -62,8 +63,9 @@ public void testProducedFromPsiMethod() throws Throwable {
(BlazeCommandRunConfiguration) fromContext.getConfiguration();
assertThat(config.getTargets())
.containsExactly(TargetExpression.fromStringSafe("//java/com/google/test:TestClass"));
String junit4Dollar = (jUnitVersionUnderTest == JUnitVersion.JUNIT_4 ? "$" : "");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO such checks should be done in the base class.

Copy link
Contributor Author

@joca-bt joca-bt Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like adding a protected field in the base class so that it can be re-used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the fact that the accommodation for a particular version of JUnit (which in theory should be abstracted away by BlazeJUnitRunConfigurationProducerTestCase) leaks into the actual test cases. However, this isn't a big deal, and it shouldn't be an obstacle towards merging this PR.

Copy link
Contributor Author

@joca-bt joca-bt Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me neither, but the reality is that the behaviour of the tool is different per JUnit version (and has questionable hardcoded coupled behaviour to Google's test runner), so we don't have much alternative to cover the different behaviours in the tests, in one way or another.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, this isn't a big deal, and it shouldn't be an obstacle towards merging this PR.

Do you want to approve it then?

@jastice jastice self-requested a review February 25, 2025 10:16
While `$` may be useful in other JUnit versions to determine where a "class boundary" ends, as the
plugin is using `,` for enumeration in that case (i.e. `mypackage.myClass1#myMethod1,myMethod2$|...`),
it is not needed when the enumeration is between `()` as in JUnit5 (i.e. `mypackage.myClass1#(myMethod1|myMethod2)|...`).
@jastice jastice merged commit ba6490e into bazelbuild:master Feb 25, 2025
5 checks passed
@github-actions github-actions bot removed the awaiting-review Awaiting review from Bazel team on PRs label Feb 25, 2025
joca-bt added a commit to joca-bt/extra_rules_java that referenced this pull request Mar 24, 2025
joca-bt added a commit to joca-bt/extra_rules_java that referenced this pull request Mar 24, 2025
joca-bt added a commit to joca-bt/extra_rules_java that referenced this pull request Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: IntelliJ IntelliJ plugin
Projects
Development

Successfully merging this pull request may close these issues.

6 participants