function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Óli Þór GunnarssonÓli Þór Gunnarsson 

Failed to run tests synchronously.: java.lang.reflect.InvocationTargetException

Hi all,
 
We are using Platform events and trigger on platform event as subscriber. Test Class for one of several Event triggers is now generating error.
 
We used to have several functions in one Apex test class and only one of the functions has errors. I tried removing that function to separate apex test class and then the others run successfully but this one is still not working.
When we run the test it generates error with the message: "Failed to run tests synchronously.: java.lang.reflect.InvocationTargetException".
 
Lines causing error: "Test.getEventBus().deliver();"
 
I have had hard time to find information about what might be causing this...
SwethaSwetha (Salesforce Developers) 
HI Oli,
Do you have flows involved in this functionality?

Related: https://salesforce.stackexchange.com/questions/350108/how-to-test-platform-event-trigger-flow/375172#375172

Thanks
Óli Þór GunnarssonÓli Þór Gunnarsson
Thanks for the reply,

There are no flows that are subscribed to the event, only Apex Trigger is subscribed.

Thanks