TradeMessageFixture
serves to create a context for testing trade interactions, through
the use of a trade subscriber mock object.
Tests may use the TradeMessageFixture
to:
given(PM is in state A)
when("trade.eventReceived => 'ExecuteAck|TRADE_CONF_EXECUTE_DATA'")
then(PM is in state B)
given(PM is in state A)
when("trade.statusEnabled => false")
then(PM is in state B)
given(PM is in state A)
when (execute button is pressed)
then ("trade.eventSent = 'Execute|TRADE_EXECUTE_DATA'")
Attributes | Name and Description |
---|---|
|
caplin.trading.testing.TradeMessageFixture()
Constructs a |
Attributes | Name and Description |
---|---|
|
void
addNamedValueMap(String sName, Map mValues)
This method enables a FixtureFactory to register a set of record identifiers and corresponding map of mock record field data with this TradeMessageFixture. |
|
void
canHandleProperty( sProperty)
TradeMessageFixture handles properties 'eventReceived', 'eventSent' and 'statusEnabled'. |
|
void
doGiven(String sPropertyName, Variant vValue)
This method can be used with the 'eventReceived' or 'statusEnabled' properties to trigger the stub to simulate these events being received from the server. |
|
void
doThen(String sPropertyName, Variant vValue)
This method can be used to check whether the last trade event 'sent' by the trading stub was the one expected. |
|
void
doWhen(String sPropertyName, Variant vValue)
This method can be used with the 'eventReceived' or 'statusEnabled' properties to trigger the stub to simulate these events being received from the server. |
|
void
setTradeMessageServiceStub(caplin.trading.testing.TradeMessageServiceStub oTradeMessageServiceStub)
Sets a TradeMessageServiceStub to be used by this fixture to simulate trade events. |
►
caplin.trading.testing.TradeMessageFixture()
Constructs a caplin.trading.testing.TradeMessageFixture
.
►
void
addNamedValueMap(String sName, Map mValues)
This method enables a FixtureFactory to register a set of record identifiers and corresponding map of mock
record field data with this TradeMessageFixture. Tests using the fixture to receive mock messages or verify
events sent by the trade are able to refer to record data using property value '
String | sName | the record identifier. |
Map | mValues | the record data map from field data to field value. |
►
void
canHandleProperty( sProperty)
TradeMessageFixture handles properties 'eventReceived', 'eventSent' and 'statusEnabled'.
sProperty |
►
void
doGiven(String sPropertyName, Variant vValue)
This method can be used with the 'eventReceived' or 'statusEnabled' properties to trigger the stub to simulate these events being received from the server. The 'eventReceived' property must be supplied with a trade event name and optional data map id, in the format NAME|DATA, where DATA is the key for one of the name-value pairs already supplied (caplin.trading.testing.TradeMessageFixture.addNamedValueMap).
String | sPropertyName | The property name |
Variant | vValue | The value to check |
►
void
doThen(String sPropertyName, Variant vValue)
This method can be used to check whether the last trade event 'sent' by the trading stub was the one expected. This method must be used with the property name 'eventSent', while the value is the event name and data expected in the format NAME|DATA.
String | sPropertyName | The property name |
Variant | vValue | The value to set |
►
void
doWhen(String sPropertyName, Variant vValue)
This method can be used with the 'eventReceived' or 'statusEnabled' properties to trigger the stub to simulate these events being received from the server.
String | sPropertyName | The property name |
Variant | vValue | The value to set |
►
void
setTradeMessageServiceStub(caplin.trading.testing.TradeMessageServiceStub oTradeMessageServiceStub)
Sets a TradeMessageServiceStub to be used by this fixture to simulate trade events.
caplin.trading.testing.TradeMessageServiceStub | oTradeMessageServiceStub | the trade subscriber stub. |