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

[java] Fix #4503: A false negative about JUnitTestsShouldIncludeAssert and testng #4507

Merged
merged 3 commits into from
May 19, 2023

Conversation

LynnBroe
Copy link
Contributor

@LynnBroe LynnBroe commented Apr 25, 2023

Describe the PR

This PR uses method isTestMethod instead method isJUnitMethod.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@ghost
Copy link

ghost commented Apr 25, 2023

1 Message
📖 Compared to master:
This changeset changes 0 violations,
introduces 10 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 13 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 10 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 13 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@oowekyala
Copy link
Member

I suppose we should rename the rule TestWithoutAssert or so, since it is not JUnit specific anymore.

@jsotuyod
Copy link
Member

jsotuyod commented May 2, 2023

Yeah, that would apply to several JUnit rules actually. And there are other misnomers:

  • JUnit4TestShouldUseBeforeAnnotation actually checks for a correct transition from JUnit 3 to either 4 or 5.
  • Same applies to JUnit4TestShouldUseTestAnnotation
  • JUnitAssertionsShouldIncludeMessage applies to both, JUnit and TestNg
  • JUnitTestContainsTooManyAsserts applies to both, JUnit and TestNg
  • With this PR, JUnitTestsShouldIncludeAssert applies to both, JUnit and TestNg

I'll create a separate issue from this comment to track these required renames / doc changes.

@adangel adangel added this to the 7.0.0 milestone May 19, 2023
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks!

…/bestpractices/xml/JUnitTestsShouldIncludeAssert.xml [skip ci]
adangel added a commit to adangel/pmd that referenced this pull request May 19, 2023
adangel added a commit to adangel/pmd that referenced this pull request May 19, 2023
[java] Fix pmd#4503: A false negative about JUnitTestsShouldIncludeAssert and testng pmd#4507
@adangel adangel merged commit d628e80 into pmd:master May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[java] JUnitTestsShouldIncludeAssert: false negative with TestNG
4 participants