Skip to main content

From order trigger handler invoking service class which publishes platform event on order after insert, in trigger handler calling service class  in try catch block, and in subscriber handler inside try catch im updating order owner, in test class how to cover this exceptions in catch block

 

If i dont give values to platform event and try to publish event , still i get database.save result as isSucces= true,  status code = operation enqueued

1 Antwort
  1. 27. März 2024, 11:24
    Abstract the method which handles update to data on record, and you can call that method directly from test method with some invalid data that should generate exception and cause your exception block to be executed.
0/9000