The
TriggerFixture
allows for testing of components that use the
caplin/alerts/TriggerService
.
The following actions are supported:
- addTrigger
-
Creates a new trigger, using
module:caplin/alerts/testing/TriggerServiceStub#addTrigger
.
To specify the trigger subject condition, include them in a pipe-separated list as follows:
when("triggerservice.addTrigger => '/FX/GBPUSD|rate > 1'");
- createTriggerRejected
-
Rejects the last request made to the service to create a trigger.
It ignores whatever value you provide, but the Verifier framework requires that you pass some value to it.
when("triggerservice.createTriggerRejected => true");
- triggerTrigger
-
Passes the trigger referred to by the given index to
module:caplin/alerts/testing/TriggerServiceStub#triggerTrigger
.
For example, the following snippet triggers the first trigger created:
when("triggerservice.triggerTrigger => 0");
- removeTrigger
-
Passes the trigger referred to by the given index to
module:caplin/alerts/testing/TriggerServiceStub#removeTrigger
.
For example, the following snippet removes the first trigger created:
when("triggerservice.removeTrigger => 0");
- disposeTriggerRejected
-
Rejects the last request made to the service to dispose a trigger.
It ignores whatever value you provide, but the Verifier framework requires that you pass some value to it.
when("triggerservice.disposeTriggerRejected => true");
- status
-
Sets the status of the trigger service to the given string, using
module:caplin/alerts/testing/TriggerServiceStub#setStatus
, e.g.
when("triggerservice.status => 'UNAVAILABLE'");