-2

This question is an exact duplicate of:

    for (Database.SaveResult result : results) {
    if (!result.isSuccess()) {
        for (Database.Error error : result.getErrors()) {
            System.debug('Error returned: ' +
                error.getStatusCode() +' - '+
                error.getMessage());
        }

And Do need to write test class for below trigger?

 trigger Cases on Case (after insert) {
   if(Trigger.isAfter) {
    // Send the list of cases (Trigger.new) to the example function
    ExampleClass.publishCaseUpdateNotifications(Trigger.new);
  }
}

marked as duplicate by Derek F, Pranay Jaiswal, glls, Vijay Ganji, battery.cord Jun 10 at 13:15

This question was marked as an exact duplicate of an existing question.

0

you should pass invalid values for PF event via case. please try below code and let me know if you get any issue .

 @isTest
   public class ExampleTestClass {
  @testSetup static void setup(){
       Case testcase = new Case(Subject ='Test');
       insert testcase;
}

@isTest
static void testClassforExample(){

  List<Case> lsttestcases = [SELECT Id,CaseNumber FROM Case];
   Test.startTest();
   ExampleClass.publishCaseUpdateNotifications(lsttestcases );
   Test.stopTest();
 List<Case_Updated__c> casUp = [Select Id From Case_Updated__c];
  System.assertEquals(1, ExampleClass.notifications.size());
   List<Case> invalidcaselst = List<Case>();
   invalidcaselst.add(new Case(Subject ='Test', Id= '' ));
   Test.startTest();
   ExampleClass.publishCaseUpdateNotifications(invalidcaselst );
   Test.stopTest();
  }  

}

Not the answer you're looking for? Browse other questions tagged or ask your own question.