Caplin Trader 4.8.0

Class: module:caplin/testing/DataSubscriptionFixture

module:caplin/testing/DataSubscriptionFixture

The DataSubscriptionFixture serves to create a context for providing mock price message updates, through the use of 'caplin.message-service'.

Tests may use the DataSubscriptionFixture to:

  • update a record's data: given(PM is in state A)
    when("message.dataUpdateReceived => '/FX/USDGBP|DATA_UPDATE_1'")
    then(PM is in state B)
  • update a record's status: given(PM is in state A)
    when("message.dataStatusChanged => '/FX/USDGBP|STALE'")
    then(PM is in state B)
  • check if a record is subscribed to: given(PM is in state A)
    then("message.subjectRequested => '/FX/USDGBP'")
  • check if a record is not subscribed to: given(PM is in state A)
    then("message.subjectNotRequested => '/FX/USDGBP'")
  • send multiple data updates: given(PM is in state A)
    when("dataSubscription.multipleUpdatesReceived => '/FUT/LADDER/ZLE/Q11|PRICE_UPDATE|0-9'")
  • send a subscription error: given(PM is in state A)
    when("dataSubscription.dataErrorReceived => '/FUT/LADDER/ZLE/Q11|NOT_FOUND'");

Constructor

new module:caplin/testing/DataSubscriptionFixture()

Implements:

Methods

addNamedValueMap(name, values, meta)

This method enables a FixtureFactory to register a set of data update identifiers and corresponding maps of mock field data with this DataSubscriptionFixture. Tests using the fixture to send mock data updates are able to refer to update data using property value 'Subject_name|Data_update_identifier'.
Parameters:
Name Type Description
name String the data update identifier.
values Map the update data map from field names to field values.
meta Map data for the field update

canHandleProperty(propertyName)

DataSubscriptionFixture can handle the properties 'dataUpdateReceived', 'dataStatusChanged', 'subjectRequested', 'subjectNotRequested', 'multipleUpdatesReceived' and 'dataErrorReceived'.
Parameters:
Name Type Description
propertyName String The property to check.
Implements:
See:

doGiven()

Implements:
See:

doThen()

Implements:
See:

doWhen()

Implements:
See: