From 2a52757aa550731e82d400e727a00478d1a36af2 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 30 Nov 2015 09:26:13 +0100 Subject: [PATCH] #1446 False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used --- .../src/main/resources/rulesets/java/migrating.xml | 2 ++ .../xml/JUnit4TestShouldUseAfterAnnotation.xml | 14 ++++++++++++++ .../xml/JUnit4TestShouldUseBeforeAnnotation.xml | 14 ++++++++++++++ src/site/markdown/overview/changelog.md | 2 ++ 4 files changed, 32 insertions(+) diff --git a/pmd-java/src/main/resources/rulesets/java/migrating.xml b/pmd-java/src/main/resources/rulesets/java/migrating.xml index 1e901a5b7a..a69a5b1d00 100644 --- a/pmd-java/src/main/resources/rulesets/java/migrating.xml +++ b/pmd-java/src/main/resources/rulesets/java/migrating.xml @@ -310,6 +310,7 @@ JUnit 4 skips the setUp method and executes all methods annotated with @Before b @@ -346,6 +347,7 @@ JUnit 4 skips the tearDown method and executes all methods annotated with @After diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseAfterAnnotation.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseAfterAnnotation.xml index 38e40b9fe0..836d547faa 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseAfterAnnotation.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseAfterAnnotation.xml @@ -47,4 +47,18 @@ public class Foo { } ]]> + + #1446 False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used + 0 + + diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseBeforeAnnotation.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseBeforeAnnotation.xml index a243d6c9eb..7548aebf81 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseBeforeAnnotation.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/migrating/xml/JUnit4TestShouldUseBeforeAnnotation.xml @@ -56,6 +56,20 @@ public class Foo { public void setUp() { esSetup.execute(EsSetup.deleteAll()); } +} + ]]> + + + #1446 False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index b2b015975d..c233066283 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -25,6 +25,8 @@ * [#1440](https://sourceforge.net/p/pmd/bugs/1440/): NPE in AvoidCallingFinalize * java-imports/UnnecessaryFullyQualifiedName * [#1436](https://sourceforge.net/p/pmd/bugs/1436/): UnnecessaryFullyQualifiedName false positive on clashing static imports with enums +* java-migrating/JUnit4TestShouldUseBeforeAnnotation + * [#1446](https://sourceforge.net/p/pmd/bugs/1446/): False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used * java-naming/SuspiciousEqualsMethodName * [#1431](https://sourceforge.net/p/pmd/bugs/1431/): SuspiciousEqualsMethodName false positive * java-optimizations/RedundantFieldInitializer