• Matt Behr 2
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am having trouble testing a portion of our solution leveraging Platform Events.  

I have an Apex Trigger on a Platform Event which after some logic publishes additional Platform Event.  

I cannot for the life of me get the 2nd Platform Events to fire in @Test methods.  They work fine in functional tests (not in Test context).  

Originally the trigger was firing the same type of Platform Event.  Thinking this may be the problem, I rearchitected the code to fire a separate Platform Event Type (__e).  I have also tried firing in @future methods.  And placing Test.getEventBus().deliver();  in the test method.  

Nothing seems to work.  Has anyone else encountered this?  
I am having trouble testing a portion of our solution leveraging Platform Events.  

I have an Apex Trigger on a Platform Event which after some logic publishes additional Platform Event.  

I cannot for the life of me get the 2nd Platform Events to fire in @Test methods.  They work fine in functional tests (not in Test context).  

Originally the trigger was firing the same type of Platform Event.  Thinking this may be the problem, I rearchitected the code to fire a separate Platform Event Type (__e).  I have also tried firing in @future methods.  And placing Test.getEventBus().deliver();  in the test method.  

Nothing seems to work.  Has anyone else encountered this?  
I am having trouble testing a portion of our solution leveraging Platform Events.  

I have an Apex Trigger on a Platform Event which after some logic publishes additional Platform Event.  

I cannot for the life of me get the 2nd Platform Events to fire in @Test methods.  They work fine in functional tests (not in Test context).  

Originally the trigger was firing the same type of Platform Event.  Thinking this may be the problem, I rearchitected the code to fire a separate Platform Event Type (__e).  I have also tried firing in @future methods.  And placing Test.getEventBus().deliver();  in the test method.  

Nothing seems to work.  Has anyone else encountered this?