Java Code Examples for net.serenitybdd.screenplay.Actor#recall()

The following examples show how to use net.serenitybdd.screenplay.Actor#recall() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@When("^(.*) (?:purchases|has purchased) (\\d+) (.*) shares at \\$(.*) each$")
public void purchases_shares(String traderName, int amount, String securityCode, double marketPrice) {

    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    trader.attemptsTo(
            PlaceOrder.to(Buy, amount)
                      .sharesOf(securityCode)
                      .atPriceOf(marketPrice)
                      .forClient(registeredClient)
    );
}
 
Example 2
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@When("^(.*) sells (\\d+) (.*) shares for \\$(.*) each$")
public void sells_shares(String traderName, int amount, String securityCode, double marketPrice) {

    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    trader.attemptsTo(
            PlaceOrder.to(Sell, amount)
                    .sharesOf(securityCode)
                    .atPriceOf(marketPrice)
                    .forClient(registeredClient)
    );
}
 
Example 3
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@Then("^(.*) should have the following positions:$")
public void should_have_the_following_positions(String traderName, DataTable expectedPositionTable) {

    String[] relevantFields = relevantFieldsInTable(expectedPositionTable);
    List<Position> expectedPositions = expectedPositionTable.asList(Position.class);
    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    List<Position> clientPositons = trader.asksFor(ThePortfolio.positionsForClient(registeredClient));

    assertThat(clientPositons)
            .usingElementComparatorOnFields(relevantFields)
            .containsAll(expectedPositions);
}