Menu

#1446 [java] JUnit4TestShouldUseBeforeAnnotation: False positive when TestNG is used

PMD-5.3.6
closed
PMD
3-Major
Bug
5.3.1
JUnit4TestShouldUseBeforeAnnotation
2016-06-25
2015-11-26
Julien Herr
No

I'm using pmd via SonarQube and JUnit4TestShouldUseBeforeAnnotation is triggered with the following code:

@BeforeMethod
public void setUp(Method m) {
  ...
}

@BeforeMethod from TestNG is equivalent to @Before from JUnit.

Related

Issues: #1447

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-11-30
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.6
     
  • Andreas Dangel

    Andreas Dangel - 2015-11-30

    Alternatively you can disable the JUnit rules, as you are using TestNG and not JUnit :) As the name of the rules indicate, they are supposed to be used with JUnit...

     
  • Julien Herr

    Julien Herr - 2015-11-30

    This will be fixed with PMD 5.3.6 and later.

    Great!

    Alternatively you can disable the JUnit rules, as you are using TestNG and not JUnit :)

    For sure! That's what I will do.

    As the name of the rules indicate, they are supposed to be used with JUnit...

    +1 but in this case the name should changed or TestNG should have its own rules.

     
  • Andreas Dangel

    Andreas Dangel - 2016-06-25
    • labels: --> java, testng
    • summary: False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used --> [java] JUnit4TestShouldUseBeforeAnnotation: False positive when TestNG is used
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.