forked from phoedos/pmd
Update release notes, refs #1694
This commit is contained in:
@@ -9,6 +9,33 @@
|
||||
Rules which enforce generally accepted best practices.
|
||||
</description>
|
||||
|
||||
<rule name="ApexAssertionsShouldIncludeMessage"
|
||||
since="6.13.0"
|
||||
message="Apex test assert statement should make use of the message parameter."
|
||||
class="net.sourceforge.pmd.lang.apex.rule.bestpractices.ApexAssertionsShouldIncludeMessageRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage">
|
||||
<description>
|
||||
The second parameter of System.assert/third parameter of System.assertEquals/System.assertNotEquals is a message.
|
||||
Having a second/third parameter provides more information and makes it easier to debug the test failure and
|
||||
improves the readability of test output.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
<![CDATA[
|
||||
@isTest
|
||||
public class Foo {
|
||||
@isTest
|
||||
static void methodATest() {
|
||||
System.assertNotEquals('123', o.StageName); // not good
|
||||
System.assertEquals('123', o.StageName, 'Opportunity stageName is wrong.'); // good
|
||||
System.assert(o.isClosed); // not good
|
||||
System.assert(o.isClosed, 'Opportunity is not closed.'); // good
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ApexUnitTestClassShouldHaveAsserts"
|
||||
since="5.5.1"
|
||||
message="Apex unit tests should System.assert() or assertEquals() or assertNotEquals()"
|
||||
@@ -34,6 +61,38 @@ public class Foo {
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ApexUnitTestMethodShouldHaveIsTestAnnotation"
|
||||
since="6.13.0"
|
||||
message="Apex test methods should have @isTest annotation."
|
||||
class="net.sourceforge.pmd.lang.apex.rule.bestpractices.ApexUnitTestMethodShouldHaveIsTestAnnotationRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_bestpractices.html#apexunittestmethodshouldhaveistestannotation">
|
||||
<description>
|
||||
Apex test methods should have @isTest annotation.
|
||||
As testMethod keyword is deprecated, Salesforce advices to use @isTest annotation for test class/methods.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
<![CDATA[
|
||||
@isTest
|
||||
private class ATest {
|
||||
@isTest
|
||||
static void methodATest() {
|
||||
}
|
||||
static void methodBTest() {
|
||||
}
|
||||
@isTest static void methodCTest() {
|
||||
System.assert(1==2);
|
||||
}
|
||||
@isTest static void methodCTest() {
|
||||
System.debug('I am a debug statement');
|
||||
}
|
||||
private void fetchData() {
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ApexUnitTestShouldNotUseSeeAllDataTrue"
|
||||
since="5.5.1"
|
||||
message="Apex unit tests should not use @isTest(seeAllData = true)"
|
||||
@@ -106,62 +165,6 @@ trigger Accounts on Account (before insert, before update, before delete, after
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
<rule name="ApexAssertionsShouldIncludeMessage"
|
||||
since="6.13.0"
|
||||
message="Apex test assert statement should make use of the message parameter."
|
||||
class="net.sourceforge.pmd.lang.apex.rule.bestpractices.ApexAssertionsShouldIncludeMessageRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage">
|
||||
<description>
|
||||
The second parameter of System.assert/third parameter of System.assertEquals/System.assertNotEquals is a message.
|
||||
Having a second/third parameter provides more information and makes it easier to debug the test failure and improves the readability of test output.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
<![CDATA[
|
||||
@isTest
|
||||
public class Foo {
|
||||
@isTest
|
||||
static void methodATest() {
|
||||
System.assertNotEquals('123', o.StageName); // not good
|
||||
System.assertEquals('123', o.StageName, 'Opportunity stageName is wrong.'); // good
|
||||
System.assert(o.isClosed); // not good
|
||||
System.assert(o.isClosed, 'Opportunity is not closed.'); // good
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
<rule name="ApexUnitTestMethodShouldHaveIsTestAnnotation"
|
||||
since="6.13.0"
|
||||
message="Apex test methods should have @isTest annotation."
|
||||
class="net.sourceforge.pmd.lang.apex.rule.bestpractices.ApexUnitTestMethodShouldHaveIsTestAnnotationRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_bestpractices.html#apexunittestmethodshouldhaveistestannotation">
|
||||
<description>
|
||||
Apex test methods should have @isTest annotation.
|
||||
As testMethod keyword is deprecated, Salesforce advices to use @isTest annotation for test class/methods.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
<![CDATA[
|
||||
@isTest
|
||||
private class ATest {
|
||||
@isTest
|
||||
static void methodATest() {
|
||||
}
|
||||
static void methodBTest() {
|
||||
}
|
||||
@isTest static void methodCTest() {
|
||||
System.assert(1==2);
|
||||
}
|
||||
@isTest static void methodCTest() {
|
||||
System.debug('I am a debug statement');
|
||||
}
|
||||
private void fetchData() {
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
Reference in New Issue
Block a user