diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 17ffdd2ccb..023cc34cc5 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,7 +18,7 @@ This is a {{ site.pmd.release_type }} release. Several rules for unit testing have been renamed to better reflect their actual scope. Lots of them were called after JUnit / JUnit 4, even when they applied to JUnit 5 and / or TestNG. -* `java/bestpractices/JUnit4TestShouldUseAfterAnnotation` has been renamed to {% rule java/bestpractices/JUnitTestShouldUseAfterAnnotation %} +* `java/bestpractices/JUnit4TestShouldUseAfterAnnotation` has been renamed to {% rule java/bestpractices/UnitTestShouldUseAfterAnnotation %} * `java/bestpractices/JUnit4TestShouldUseBeforeAnnotation` has been renamed to {% rule java/bestpractices/UnitTestShouldUseBeforeAnnotation %} diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index efa61aed91..684a2cf539 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -666,54 +666,7 @@ public class GoodTest { - - - - -This rule detects methods called tearDown() that are not properly annotated as a setup method. -This is primarily intended to assist in upgrading from JUnit 3, where tear down methods were required to be called tearDown(). -To a lesser extent, this may help detect omissions under newer JUnit versions, as long as you are following this convention to name the methods. - -JUnit 4 will only execute methods annotated with @After after running each test. -JUnit 5 introduced @AfterEach and @AfterAll annotations to execute methods after each test or after all tests in the class, respectively. - - 3 - - - - - - - - - - - + @@ -1415,6 +1368,53 @@ class Foo{ + + + This rule detects methods called `tearDown()` that are not properly annotated as a cleanup method. + This is primarily intended to assist in upgrading from JUnit 3, where tear down methods were required to be called `tearDown()`. + To a lesser extent, this may help detect omissions under newer JUnit versions, as long as you are following this convention to name the methods. + + JUnit 4 will only execute methods annotated with `@After` after running each test. + JUnit 5 introduced `@AfterEach` and `@AfterAll` annotations to execute methods after each test or after all tests in the class, respectively. + + 3 + + + + + + + + + + + + [java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592 0