As part of the Subscription Management license, certain platform events are fired when an Asset
is updated, an Invoice
is processed etc.
For example the CreateAssetOrderEvent.
Currently we are using an Apex platform event trigger to process this event, which works perfectly in the org.
The issue is that we require at least one line of the trigger to be covered by unit tests in order to deploy to production, and it is impossible to do that because:
- A
CreateAssetOrderEvent
cannot be inserted via Apex - A
CreateAssetOrderEvent
cannot be published as part of anEventBus.publish()
call - A
CreateAssetOrderEvent
cannot be triggered indirectly because it can only be triggered by an API call to/actions/standard/createOrUpdateAssetFromOrder
, and test methods cannot make API calls, only mock them. - Triggers do not support any static variables or methods, and we cannot directly invoke them.
Is there any workaround other than switching from an Apex trigger subscriber to a flow subscriber?