Merge branch 'pr-331'
This commit is contained in:
commit
3b48da676e
3 files changed
+28
-2
No files matched your search
+9
-2
@@ -138,9 +138,17 @@ public class JUnitTestsShouldIncludeAssertRule extends AbstractJUnitRule {
|
||||
Map<String, List<NameOccurrence>> expectables) {
|
||||
|
||||
if (expression != null) {
|
||||
|
||||
ASTPrimaryExpression pe = expression.getFirstChildOfType(ASTPrimaryExpression.class);
|
||||
if (pe != null) {
|
||||
String img = pe.jjtGetChild(0).jjtGetChild(0).getImage();
|
||||
Node subChild = pe.jjtGetChild(0).jjtGetChild(0);
|
||||
|
||||
// case of eg AllocationExpression
|
||||
if (!(subChild instanceof ASTName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String img = subChild.getImage();
|
||||
if (img.indexOf(".") == -1) {
|
||||
return false;
|
||||
}
|
||||
@@ -160,4 +168,3 @@ public class JUnitTestsShouldIncludeAssertRule extends AbstractJUnitRule {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+17
@@ -312,4 +312,21 @@ public class SimpleExpectedExceptionTest {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#330 Rule treats AllocationExpression correctly</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
|
||||
import org.junit.*;
|
||||
import javafx.embed.swing.JFXPanel;
|
||||
|
||||
public class BaseConsoleTest extends UART {
|
||||
@Test
|
||||
public void testInitialize() throws InterruptedException {
|
||||
new JFXPanel(); // AllocationExpression
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
</test-data>
|
||||
@@ -468,6 +468,7 @@ You need to use this, if you have a large project with many files, and you hit t
|
||||
* [#1555](https://sourceforge.net/p/pmd/bugs/1555/): \[java] UnnecessaryFullyQualifiedName: Really necessary fully qualified name
|
||||
* java-junit
|
||||
* [#285](https://github.com/pmd/pmd/issues/285): \[java] JUnitTestsShouldIncludeAssertRule should support @Rule as well as @Test(expected = ...)
|
||||
* [#330](https://github.com/pmd/pmd/issues/330): \[java] NPE applying rule JUnitTestsShouldIncludeAssert
|
||||
* java-logging-java
|
||||
* [#1541](https://sourceforge.net/p/pmd/bugs/1541/): \[java] InvalidSlf4jMessageFormat: False positive with placeholder and exception
|
||||
* [#1551](https://sourceforge.net/p/pmd/bugs/1551/): \[java] InvalidSlf4jMessageFormat: fails with NPE
|
||||
@@ -560,4 +561,5 @@ You need to use this, if you have a large project with many files, and you hit t
|
||||
* [#314](https://github.com/pmd/pmd/pull/314): \[vf] Bug fixes for incorrect Id detection and escaping
|
||||
* [#316](https://github.com/pmd/pmd/pull/316): \[apex] Ignoring certain rules in Batch classes, Queueable, and install scripts
|
||||
* [#317](https://github.com/pmd/pmd/pull/317): \[apex] Add support for safe ID assignment from URL param
|
||||
* [#331](https://github.com/pmd/pmd/pull/331): \[java] JunitTestsShouldIncludeAssertRule now handles AllocationExpression correctly
|
||||
|
||||
Reference in new issue
Block a user