Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package game;
- import org.junit.Assert;
- import cucumber.api.java.en.And;
- import cucumber.api.java.en.Given;
- import cucumber.api.java.en.Then;
- import cucumber.api.java.en.When;
- public class GameSteps {
- Restaurant restaurant = null;
- Player player = null;
- GameController gameC = null;
- @Given("^The \"([^\"]*)\" is created with the name \"([^\"]*)\"$")
- public void setNameToId(String id, String name) throws Throwable {
- if (id == "restaurant")
- {
- restaurant = new Restaurant();
- restaurant.setName(name);
- System.out.println(id + "is created & name is now set to: " + restaurant.getName());
- }
- else if (id == "player")
- {
- player = new Player();
- player.setName(name);
- System.out.println(id + "is created & name is now set to: " + player.getName());
- }
- else System.out.println("No such " + id + ", sorry.");
- }
- @And("^The restaurant budget is initialised to (\\d+)$")
- public void setBudget(int budget) throws Throwable {
- //System.out.println("Budget is: " + budget);
- restaurant = new Restaurant();
- restaurant.setBudget(budget);
- System.out.println("Budget is now set to: " + restaurant.getBudget());
- }
- }
- //-----------------------------------------------------------------------------------------------
- package game;
- public class Restaurant {
- int reputation;
- int budget;
- String name;
- public void setName(String name_) {
- this.name = name_;
- }
- public String getName() {
- return name;
- }
- public void setBudget(int budget_) {
- budget = budget_;
- }
- public int getBudget() {
- return budget;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement