Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
TestBroker Class
Namespace
TestBroker Methods
The following are methods for TestBroker.
deliver()
Signature
public void deliver()
Return Value
Type: void
Usage
Enclose Test.getEventBus().deliver() within the Test.startTest() and Test.stopTest() statement block.
1Test.startTest();
2// Create test events
3// ...
4// Publish test events with EventBus.publish()
5// ...
6// Deliver test events
7Test.getEventBus().deliver();
8// Perform validation
9// ...
10Test.stopTest();fail()
Signature
public void fail()
Return Value
Type: void
Usage
1// Create test events
2// ...
3// Publish test events with EventBus.publish()
4// ...
5// Fail publishing of test events
6Test.getEventBus().fail();
7// Perform validation
8// ...For more information, see <link>Get the Result of Asynchronous Platform Event Publishing with Apex Publish Callbacks<link/> in the Platform Events Developer Guide.