Merge branch 'pr-466'
This commit is contained in:
@ -9,7 +9,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sourceforge.pmd.lang.ast.Node;
|
import net.sourceforge.pmd.lang.ast.Node;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTAnnotation;
|
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration;
|
import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTMarkerAnnotation;
|
import net.sourceforge.pmd.lang.java.ast.ASTMarkerAnnotation;
|
||||||
@ -81,7 +80,7 @@ public class JUnitTestsShouldIncludeAssertRule extends AbstractJUnitRule {
|
|||||||
|
|
||||||
for (NameDeclaration decl : decls.keySet()) {
|
for (NameDeclaration decl : decls.keySet()) {
|
||||||
Node parent = decl.getNode().jjtGetParent().jjtGetParent().jjtGetParent();
|
Node parent = decl.getNode().jjtGetParent().jjtGetParent().jjtGetParent();
|
||||||
if (parent.hasDescendantOfType(ASTAnnotation.class)
|
if (parent.hasDescendantOfType(ASTMarkerAnnotation.class)
|
||||||
&& parent.getFirstChildOfType(ASTFieldDeclaration.class) != null) {
|
&& parent.getFirstChildOfType(ASTFieldDeclaration.class) != null) {
|
||||||
String annot = parent.getFirstDescendantOfType(ASTMarkerAnnotation.class).jjtGetChild(0).getImage();
|
String annot = parent.getFirstDescendantOfType(ASTMarkerAnnotation.class).jjtGetChild(0).getImage();
|
||||||
if (!"Rule".equals(annot) && !"org.junit.Rule".equals(annot)) {
|
if (!"Rule".equals(annot) && !"org.junit.Rule".equals(annot)) {
|
||||||
|
@ -392,6 +392,26 @@ public class FooTest {
|
|||||||
|
|
||||||
Mockito.verify(bar, Mockito.times(1)).actuallyDoTask();
|
Mockito.verify(bar, Mockito.times(1)).actuallyDoTask();
|
||||||
}
|
}
|
||||||
|
}]]></code>
|
||||||
|
</test-code>
|
||||||
|
<test-code>
|
||||||
|
<description>#465 NullPointerException when dealing with @SuppressWarnings</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class FooTest {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private static Foo foo = new Foo();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFoo() {
|
||||||
|
assertEquals("doesn't matter", "doesn't matter");
|
||||||
|
}
|
||||||
|
|
||||||
}]]></code>
|
}]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
</test-data>
|
</test-data>
|
||||||
|
@ -94,6 +94,7 @@ by a new CyclomaticComplexity rule based on the metrics framework. See also [iss
|
|||||||
* [#348](https://github.com/pmd/pmd/issues/348): \[java] imports/UnusedImport rule not considering static inner classes of imports
|
* [#348](https://github.com/pmd/pmd/issues/348): \[java] imports/UnusedImport rule not considering static inner classes of imports
|
||||||
* java-junit
|
* java-junit
|
||||||
* [#428](https://github.com/pmd/pmd/issues/428): \[java] PMD requires public modifier on JUnit 5 test
|
* [#428](https://github.com/pmd/pmd/issues/428): \[java] PMD requires public modifier on JUnit 5 test
|
||||||
|
* [#465](https://github.com/pmd/pmd/issues/465): \[java] NullPointerException in JUnitTestsShouldIncludeAssertRule
|
||||||
* java-logging:
|
* java-logging:
|
||||||
* [#365](https://github.com/pmd/pmd/issues/365): \[java] InvalidSlf4jMessageFormat does not handle inline incrementation of arguments
|
* [#365](https://github.com/pmd/pmd/issues/365): \[java] InvalidSlf4jMessageFormat does not handle inline incrementation of arguments
|
||||||
* java-strictexceptions
|
* java-strictexceptions
|
||||||
|
Reference in New Issue
Block a user