-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stepdefs.java
30 lines (24 loc) · 866 Bytes
/
Stepdefs.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package se.thinkcode.itake;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class StepDefinitions {
private Belly belly;
private int waitingTime;
@Given("^I have (\\d+) cukes in my belly$")
public void i_have_cukes_in_my_belly(int cukes) throws Throwable {
belly = new Belly();
belly.eat(cukes);
}
@When("^I wait (\\d+) hour$")
public void i_wait_hour(int waitingTime) throws Throwable {
this.waitingTime = waitingTime;
}
@Then("^my belly should (.*)$")
public void my_belly_should_growl(String expectedSound) throws Throwable {
String actualSound = belly.getSound(waitingTime);
assertThat(actualSound, is(expectedSound));
}
}