Skip to content

Instantly share code, notes, and snippets.

@maggandalf
Created April 20, 2011 17:02
Show Gist options
  • Select an option

  • Save maggandalf/931937 to your computer and use it in GitHub Desktop.

Select an option

Save maggandalf/931937 to your computer and use it in GitHub Desktop.
Trading Service Steps for testing with JBehave
@Steps
public class TradingServiceSteps {
@Autowired
private TradingService tradingService = null;
private Stock stock;
@Given("a stock of symbol <symbol> and a threshold of <threshold>")
public void aStock(@Named("symbol")String symbol, @Named("threshold")double threshold) {
stock = tradingService.addNewStock(symbol, threshold);
}
@When("the stock is traded at <price>")
public void theStockIsTradedAt(@Named("price")double price) {
stock.setTradeAt(price);
}
@Then("the alert status should be <status>")
public void theAlertStatusShouldBe(@Named("status")StockAlertStatus status) {
assertThat(stock.getStatus(), equalTo(status));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment