diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/security/xml/ApexCRUDViolation.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/security/xml/ApexCRUDViolation.xml index a36ef8b676..7339707b45 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/security/xml/ApexCRUDViolation.xml +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/security/xml/ApexCRUDViolation.xml @@ -1441,6 +1441,54 @@ public class Foo { AuthorizationUtil.assertMergeable(Account.SObjectType); Database.merge(masterAccount, mergeAccount, false); } +} + ]]> + + + + >#3576 - Verify use of *AuthMethodTypeParamIndex + SomeAuthUtil\.canCreate\w+ + 1 + SomeAuthUtil\.canRead\w+ + 2 + SomeAuthUtil\.canUpdate\w+ + 3 + SomeAuthUtil\.canDelete\w+ + 4 + SomeAuthUtil\.canUndelete\w+ + 0 + SomeAuthUtil\.canMerge\w+ + + 0 + (new Account(Name = 'X')); + } + + if (SomeAuthUtil.canReadWithTypeAsThirdParam(param1, param2, Account.SObjectType)) { + List accounts = [SELECT Id FROM Account]; + } + + if (SomeAuthUtil.canUpdateWithTypeAsFourthParam(param1, param2, param3, Account.SObjectType)) { + update new List(new Account(Name = 'X')); + } + + if (SomeAuthUtil.canDeleteWithTypeAsFifthParam(param1, param2, param3, param4, Account.SObjectType)) { + delete new List(new Account(Name = 'X')); + } + + if (SomeAuthUtil.canUndeleteWithTypeAsFirstParamExplicit(Account.SObjectType)) { + undelete new List(new Account(Name = 'X')); + } + + Account masterAccount; + Account mergeAccount; + if (SomeAuthUtil.canMergeWithTypeAsFirstParamImplicit(Account.SObjectType)) { + merge masterAccount mergeAccount; + } + } } ]]>