#1400 False positive with JUnit4TestShouldUseBeforeAnnotation

This commit is contained in:
Andreas Dangel
2015-09-05 19:39:31 +02:00
parent 58292bfc38
commit f0dd2b0519
3 changed files with 15 additions and 2 deletions

View File

@ -311,7 +311,7 @@ JUnit 4 skips the setUp method and executes all methods annotated with @Before b
<value>
<![CDATA[
//ClassOrInterfaceBodyDeclaration[MethodDeclaration/MethodDeclarator[@Image='setUp']]
[count(Annotation/MarkerAnnotation/Name[@Image='Before'])=0]
[count(Annotation//Name[@Image='Before'])=0]
]]>
</value>
</property>
@ -347,7 +347,7 @@ JUnit 4 skips the tearDown method and executes all methods annotated with @After
<value>
<![CDATA[
//ClassOrInterfaceBodyDeclaration[MethodDeclaration/MethodDeclarator[@Image='tearDown']]
[count(Annotation/MarkerAnnotation/Name[@Image='After'])=0]
[count(Annotation//Name[@Image='After'])=0]
]]>
</value>
</property>

View File

@ -47,4 +47,16 @@ public class Foo {
}
]]></code>
</test-code>
<test-code>
<description>#1400 False positive with JUnit4TestShouldUseBeforeAnnotation</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Foo {
@Before("@ResetEsSetup")
public void setUp() {
esSetup.execute(EsSetup.deleteAll());
}
}
]]></code>
</test-code>
</test-data>

View File

@ -15,6 +15,7 @@
* [#1370](https://sourceforge.net/p/pmd/bugs/1370/): ConsecutiveAppendsShouldReuse not detected properly on StringBuffer
* [#1371](https://sourceforge.net/p/pmd/bugs/1371/): InsufficientStringBufferDeclaration not detected properly on StringBuffer
* [#1384](https://sourceforge.net/p/pmd/bugs/1384/): NullPointerException in ConsecutiveLiteralAppendsRule
* [#1400](https://sourceforge.net/p/pmd/bugs/1400/): False positive with JUnit4TestShouldUseBeforeAnnotation
* [#1401](https://sourceforge.net/p/pmd/bugs/1401/): False positive for StringBuilder.append called with constructor
* [#1402](https://sourceforge.net/p/pmd/bugs/1402/): Windows-Only: File exclusions are not case insensitive