dimanche 23 juin 2019

How can i write test for apex trigger using assert method?

Here is code: trigger ProductTrigger on Product__c (before insert, before update) {

Schema.DescribeFieldResult F = Product__c.Description__c.getDescribe(); 
Integer lengthOfField = F.getLength();
List<Product__c> prList = new list<Product__c>(); 
for(Product__c pr: trigger.new){
    pr.AddedDate__c=system.today();
    if (String.isNotEmpty(pr.Description__c)) {
       pr.Description__c = pr.Description__c.abbreviate(lengthOfField);
    }
} 

}

Aucun commentaire:

Enregistrer un commentaire