Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cucumber for Java. Checking .isAnnotationType before annotation usage…
… search
- Loading branch information
Showing
4 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...r-java/testData/resolve/stepDefContainerMarkedWithStepDefAnnotation/ShoppingStepdefs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package cucumber.examples.java.calculator; | ||
|
||
import cucumber.api.java.en.Given; | ||
import cucumber.api.java.en.Then; | ||
import cucumber.api.java.en.When; | ||
|
||
import cucumber.runtime.java.StepDefAnnotation; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@StepDefAnnotation | ||
public class ShoppingStepdefs { | ||
private RpnCalculator calc = new RpnCalculator(); | ||
|
||
@Given("^the following groceries:$") | ||
public void the_following_groceries(List<Grocery> groceries) { | ||
for (Grocery grocery : groceries) { | ||
calc.push(grocery.price); | ||
calc.push("+"); | ||
} | ||
} | ||
|
||
@When("^I pay (\\d+)$") | ||
public void i_pay(int amount) { | ||
calc.push(amount); | ||
calc.push("-"); | ||
} | ||
|
||
@Then("^my change should be (\\d+)$") | ||
public void my_change_should_be_(int change) { | ||
assertEquals(-calc.value().intValue(), change); | ||
} | ||
|
||
public static class Grocery { | ||
public String name; | ||
public int price; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
cucumber-java/testData/resolve/stepDefContainerMarkedWithStepDefAnnotation/test.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Feature: Shopping | ||
|
||
Scenario: Give correct change | ||
Given the following groceries: | ||
| name | price | | ||
| milk | 9 | | ||
| bread | 7 | | ||
| soap | 5 | | ||
When I pay 25 | ||
Then my change should be 4 |