Class
caplin.trading.testing

TOBOFixture

The TOBOFixture serves to provide a way for tests to interact with the TOBOUserService by setting the ability for the test to act as a user who can trade on behalf of other users, setting the list of TOBO users and accounts that the test can user to trade on behalf of, and setting and querying the selected TOBO user and account to trade with.

Use of the Fixture assumes that a caplin.trading.testing.TOBOUserServiceStub is registered as a service on the caplin.core.ServiceRegistry with the alias "caplin.tobo-user-service".

Tests may use the TOBOFixture to:

  • set the user type and (un)set the ability of the test to trade on behalf of TOBO users:
    given("tobo.UserType = 'SUPER_USER'")
    and("tobo.userCanTradeOnBehalfOf = true")
    ...
  • set the TOBO user and account lists:
    given("tobo.TOBOUserList = '['user1','user2']'")
    and("tobo.TOBOAccountList = '['acct1','acct2']'")
    ...
  • set the TOBO user and account to use for trading:
    given("tobo.TOBOUser = 'user1'")
    and("tobo.TOBOAccount = 'acct5'")
    ...
  • verify the TOBO user and account:
    ...
    then("tobo.TOBOUser = 'user1'")
    and("tobo.TOBOAccount = 'acct5'")

Constructor Summary

Attributes Name and Description
caplin.trading.testing.TOBOFixture()

Constructs a caplin.trading.testing.TOBOFixture.

Method Summary

Attributes Name and Description
void canHandleProperty(String sProperty)

TradeMessageFixture handles properties 'UserType', 'userCanTradeOnBehalfOf', 'TOBOUser', 'TOBOUserList', 'TOBOAccount' and 'TOBOAccountList'.

void doGiven(String sPropertyName, Variant vValue)

This method is used to set the state of the TOBOUserService, determining whether the test can trade on behalf of a TOBO user, the test's user type, the TOBO user and account lists available to the test and the TOBO user and account to be used by the test for trading.

void doThen(String sPropertyName, Variant vValue)

This method can be used by a test to verify whether the user type and TOBO user and account on the TOBOUserService have the expected values.

Methods implemented from class caplin.testing.Fixture:
addSubFixtures, doWhen, setUp, tearDown

Constructor Detail

caplin.trading.testing.TOBOFixture()

Constructs a caplin.trading.testing.TOBOFixture.

Method Detail

void canHandleProperty(String sProperty)

TradeMessageFixture handles properties 'UserType', 'userCanTradeOnBehalfOf', 'TOBOUser', 'TOBOUserList', 'TOBOAccount' and 'TOBOAccountList'.

Parameters
String sProperty The property to check.
See
caplin.testing.Fixture#canHandleProperty

void doGiven(String sPropertyName, Variant vValue)

This method is used to set the state of the TOBOUserService, determining whether the test can trade on behalf of a TOBO user, the test's user type, the TOBO user and account lists available to the test and the TOBO user and account to be used by the test for trading.

Parameters
String sPropertyName The property name
Variant vValue the value to check
See
caplin.testing.Fixture#doGiven

void doThen(String sPropertyName, Variant vValue)

This method can be used by a test to verify whether the user type and TOBO user and account on the TOBOUserService have the expected values.

Parameters
String sPropertyName The property name
Variant vValue the value to set
See
caplin.testing.Fixture#doThen