|
1 |
| -package cucumber.junit; |
2 |
| - |
3 |
| -import static org.junit.Assert.*; |
4 |
| - |
5 |
| -import gherkin.formatter.model.Step; |
6 |
| - |
7 |
| -import java.util.Arrays; |
8 |
| -import java.util.Collections; |
9 |
| -import java.util.List; |
10 |
| - |
11 |
| -import org.junit.Test; |
12 |
| - |
13 |
| -import cucumber.io.ClasspathResourceLoader; |
14 |
| -import cucumber.runtime.model.CucumberFeature; |
15 |
| -import cucumber.runtime.model.CucumberScenario; |
16 |
| - |
17 |
| -public class ExecutionUnitRunnerTest { |
18 |
| - @Test |
19 |
| - public void shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario() throws Exception { |
20 |
| - List<CucumberFeature> features = |
21 |
| - CucumberFeature.load( |
22 |
| - new ClasspathResourceLoader(this.getClass().getClassLoader()), |
23 |
| - Arrays.asList(new String[] { "cucumber/junit/feature_with_same_steps_in_scenario.feature" }), |
24 |
| - Collections.emptyList()); |
25 |
| - |
26 |
| - ExecutionUnitRunner runner = |
27 |
| - new ExecutionUnitRunner( |
28 |
| - null, |
29 |
| - (CucumberScenario)features.get(0).getFeatureElements().get(0), |
30 |
| - null); |
31 |
| - |
32 |
| - // fish out the two occurrences of the same step and check whether we really got them |
33 |
| - Step stepOccurrence1 = runner.getChildren().get(0); |
34 |
| - Step stepOccurrence2 = runner.getChildren().get(2); |
35 |
| - assertEquals(stepOccurrence1.getName(), stepOccurrence2.getName()); |
36 |
| - |
37 |
| - assertFalse("Descriptions must not be equal.", |
38 |
| - runner.describeChild(stepOccurrence1) |
39 |
| - .equals(runner.describeChild(stepOccurrence2))); |
40 |
| - } |
41 |
| -} |
| 1 | +package cucumber.junit; |
| 2 | + |
| 3 | +import cucumber.io.ClasspathResourceLoader; |
| 4 | +import cucumber.runtime.model.CucumberFeature; |
| 5 | +import cucumber.runtime.model.CucumberScenario; |
| 6 | +import gherkin.formatter.model.Step; |
| 7 | +import org.junit.Test; |
| 8 | + |
| 9 | +import java.util.Collections; |
| 10 | +import java.util.List; |
| 11 | + |
| 12 | +import static java.util.Arrays.asList; |
| 13 | +import static org.junit.Assert.assertEquals; |
| 14 | +import static org.junit.Assert.assertFalse; |
| 15 | + |
| 16 | +public class ExecutionUnitRunnerTest { |
| 17 | + @Test |
| 18 | + public void shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario() throws Exception { |
| 19 | + List<CucumberFeature> features = CucumberFeature.load( |
| 20 | + new ClasspathResourceLoader(this.getClass().getClassLoader()), |
| 21 | + asList("cucumber/junit/feature_with_same_steps_in_scenario.feature"), |
| 22 | + Collections.emptyList() |
| 23 | + ); |
| 24 | + |
| 25 | + ExecutionUnitRunner runner = new ExecutionUnitRunner( |
| 26 | + null, |
| 27 | + (CucumberScenario) features.get(0).getFeatureElements().get(0), |
| 28 | + null |
| 29 | + ); |
| 30 | + |
| 31 | + // fish out the two occurrences of the same step and check whether we really got them |
| 32 | + Step stepOccurrence1 = runner.getChildren().get(0); |
| 33 | + Step stepOccurrence2 = runner.getChildren().get(2); |
| 34 | + assertEquals(stepOccurrence1.getName(), stepOccurrence2.getName()); |
| 35 | + |
| 36 | + assertFalse("Descriptions must not be equal.", runner.describeChild(stepOccurrence1).equals(runner.describeChild(stepOccurrence2))); |
| 37 | + } |
| 38 | +} |
0 commit comments