You need to sign in to do that
Don't have an account?
Benjamin Zerbib 3
testcreateopptywithconditionandrole
Hello everybody!
I have an issue while trying to deploy an Apex Class triggered by a Process Builder.
Here is my code:
And here is the error message I get while trying to 'Validate' the Outbound Change Set:
System.Exception: Assertion Failed
Stack Trace: Class.test_updatecontactrolecount.testcreateopptywithconditionandrole: line 38, column 1
Could you please help me out?
Thanks a lot!
Benji
I have an issue while trying to deploy an Apex Class triggered by a Process Builder.
Here is my code:
public class CMC_Automation_Code { @InvocableMethod public static void updateAccount(List<String> AccountIds){ Integer CMC_Value = 0; List<Account> AllAccounts = [SELECT Id, CMC_Auto_Number__c FROM Account where Id in:AccountIds AND CMC_Auto_Number__c = 0]; if(AllAccounts != null && AllAccounts.size()>0){ List<Account> AccList = [SELECT Id, CMC_Auto_Number__c, CreatedDate FROM Account where CMC_Auto_Number__c != null order by CMC_Auto_Number__c desc limit 1]; if(AccList != null && AccList.size()>0){ CMC_Value = integer.valueof(AccList[0].CMC_Auto_Number__c +1); } for(Account Acc:AllAccounts){ Acc.Global_Account_ID__c = 'CS-' + String.valueOf(CMC_Value); Acc.CMC_Auto_Number__c = CMC_Value; CMC_Value ++; } update AllAccounts; } } }
And here is the error message I get while trying to 'Validate' the Outbound Change Set:
System.Exception: Assertion Failed
Stack Trace: Class.test_updatecontactrolecount.testcreateopptywithconditionandrole: line 38, column 1
Could you please help me out?
Thanks a lot!
Benji
The issue is with your test class. You are running into an assertion error. Meaning your system.assertEquals appears to be returning a different value than expected. Please check line 38 of your test_updatecontactrolecount and add a debug statement there to understand the actual value and expected value. You can make changes accordingly
For reference, please look at this post where a similar issue is dicussed
Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you