[doc] Document renamed/old rule names

This commit is contained in:
Andreas Dangel 2024-10-04 15:54:21 +02:00
parent 5ce4d292fa
commit a0818d5ab2
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
2 changed files with 20 additions and 0 deletions

View File

@ -36,6 +36,14 @@ The old rule names still work but are deprecated.
* [#5067](https://github.com/pmd/pmd/issues/5067): \[java] CloseResource: False positive for FileSystems.getDefault()
### 🚨 API Changes
* java-bestpractices
* The old rule name `JUnit4TestShouldUseAfterAnnotation` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestShouldUseAfterAnnotation %} instead.
* The old rule name `JUnit4TestShouldUseBeforeAnnotation` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestShouldUseBeforeAnnotation %} instead.
* The old rule name `JUnit4TestShouldUseTestAnnotation` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestShouldUseTestAnnotation %} instead.
* The old rule name `JUnitAssertionsShouldIncludeMessage` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestAssertionsShouldIncludeMessage %} instead.
* The old rule name `JUnitTestContainsTooManyAsserts` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestContainsTooManyAsserts %} instead.
* The old rule name `JUnitTestsShouldIncludeAssert` has been deprecated. Use the new name {% rule java/bestpractices/UnitTestShouldIncludeAssert %} instead.
### ✨ Merged pull requests
* [#4965](https://github.com/pmd/pmd/pull/4965): \[java] Rename JUnit rules with overly restrictive names - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)

View File

@ -1239,6 +1239,8 @@ Unit assertions should include an informative message - i.e., use the three-argu
`assertEquals()`, not the two-argument version.
This rule supports tests using JUnit (3, 4 and 5) and TestNG.
Note: This rule was named JUnitAssertionsShouldIncludeMessage before PMD 7.7.0.
</description>
<priority>3</priority>
<example>
@ -1268,6 +1270,8 @@ public class Foo {
Customize the maximum number of assertions used by this Rule to suit your needs.
This rule checks for JUnit (3, 4 and 5) and TestNG Tests.
Note: This rule was named JUnitTestContainsTooManyAsserts before PMD 7.7.0.
</description>
<priority>3</priority>
<example>
@ -1303,6 +1307,8 @@ public class MyTestCase {
with messages provide the developer a clearer idea of what the test does.
This rule checks for JUnit (3, 4 and 5) and TestNG Tests.
Note: This rule was named JUnitTestsShouldIncludeAssert before PMD 7.7.0.
</description>
<priority>3</priority>
<example>
@ -1333,6 +1339,8 @@ public class Foo {
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.
Note: This rule was named JUnit4TestShouldUseAfterAnnotation before PMD 7.7.0.
</description>
<priority>3</priority>
<properties>
@ -1380,6 +1388,8 @@ public class MyTest2 {
JUnit 4 will only execute methods annotated with `@Before` before all tests.
JUnit 5 introduced `@BeforeEach` and `@BeforeAll` annotations to execute methods before each test or before all tests in the class, respectively.
Note: This rule was named JUnit4TestShouldUseBeforeAnnotation before PMD 7.7.0.
</description>
<priority>3</priority>
<properties>
@ -1426,6 +1436,8 @@ public class MyTest2 {
In JUnit 4, only methods annotated with the `@Test` annotation are executed.
In JUnit 5, one of the following annotations should be used for tests: `@Test`, `@RepeatedTest`, `@TestFactory`, `@TestTemplate` or `@ParameterizedTest`.
In TestNG, only methods annotated with the `@Test` annotation are executed.
Note: This rule was named JUnit4TestShouldUseTestAnnotation before PMD 7.7.0.
</description>
<priority>3</priority>
<properties>