From 1d3906356d761ec2e17a9096a07df6615424e215 Mon Sep 17 00:00:00 2001 From: "Travis CI (pmd-bot)" Date: Sun, 20 May 2018 06:10:48 +0000 Subject: [PATCH] Update documentation --- docs/pages/pmd/rules/java/bestpractices.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/pages/pmd/rules/java/bestpractices.md b/docs/pages/pmd/rules/java/bestpractices.md index 380663a00d..896c9b4c74 100644 --- a/docs/pages/pmd/rules/java/bestpractices.md +++ b/docs/pages/pmd/rules/java/bestpractices.md @@ -564,8 +564,12 @@ In JUnit 4, only methods annotated with the @Test annotation are executed. **This rule is defined by the following XPath expression:** ``` -//ClassOrInterfaceBodyDeclaration[MethodDeclaration[@Public='true']/MethodDeclarator[starts-with(@Image,'test')]] -[count(Annotation//Name[@Image='Test'])=0] +//ClassOrInterfaceDeclaration[ + matches(@Image, $testClassPattern) + or ExtendsList/ClassOrInterfaceType[pmd-java:typeof(@Image, 'junit.framework.TestCase', 'TestCase')]] + + /ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration[MethodDeclaration[@Public=true()]/MethodDeclarator[starts-with(@Image, 'test')]] + [not(Annotation//Name[pmd-java:typeof(@Image, 'org.junit.Test', 'Test')])] ``` **Example(s):** @@ -583,6 +587,12 @@ public class MyTest { } ``` +**This rule has the following properties:** + +|Name|Default Value|Description|Multivalued| +|----|-------------|-----------|-----------| +|testClassPattern|Test|The regex pattern used to identify test classes|no| + **Use this rule by referencing it:** ``` xml