Skip to content

Commit 8cb7618

Browse files
committed
Updated to JUnit 4.11. Relates to #255. Might also relate to #322. IntelliJ IDEA reports features with Background and Scenario Outline incorrect.y. Might be the case on master too.
1 parent 465a2c4 commit 8cb7618

File tree

15 files changed

+31
-641
lines changed

15 files changed

+31
-641
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ See [Contributing](http://cukes.info/contribute.html) as well as (https://github
6666

6767
## Coming from Cuke4Duke?
6868

69-
See [Migration from Cuke4Duke](https://github.com/cucumber/cucumber-jvm/blob/master/Cuke4Duke.md)
69+
See [Migration from Cuke4Duke](https://github.com/cucumber/cucumber-jvm/blob/master/Cuke4Duke.md)

core/src/main/java/cucumber/runtime/model/CucumberFeature.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void step(Step step) {
8383
currentStepContainer.step(step);
8484
}
8585

86-
public Feature getFeature() {
86+
public Feature getGherkinFeature() {
8787
return feature;
8888
}
8989

@@ -105,7 +105,7 @@ public String getUri() {
105105

106106
public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
107107
formatter.uri(getUri());
108-
formatter.feature(getFeature());
108+
formatter.feature(getGherkinFeature());
109109

110110
for (CucumberTagStatement cucumberTagStatement : getFeatureElements()) {
111111
//Run the scenario, it should handle before and after hooks

core/src/main/java/cucumber/runtime/model/CucumberScenarioOutline.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
4848
}
4949

5050
CucumberScenario createExampleScenario(ExamplesTableRow header, ExamplesTableRow example, List<Tag> examplesTags) {
51-
Scenario exampleScenario = new Scenario(example.getComments(), examplesTags, tagStatement.getKeyword(), tagStatement.getName(), "", example.getLine(), example.getId());
51+
Scenario exampleScenario = new Scenario(example.getComments(), examplesTags, getGherkinModel().getKeyword(), getGherkinModel().getName(), "", example.getLine(), example.getId());
5252
CucumberScenario cucumberScenario = new CucumberScenario(cucumberFeature, cucumberBackground, exampleScenario, example);
5353
for (Step step : getSteps()) {
5454
cucumberScenario.step(createExampleStep(step, header, example));

core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,35 @@
1313
import static gherkin.util.FixJava.join;
1414

1515
public abstract class CucumberTagStatement extends StepContainer {
16-
final TagStatement tagStatement;
16+
private final TagStatement gherkinModel;
1717
private final String visualName;
1818

19-
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement tagStatement) {
20-
super(cucumberFeature, tagStatement);
21-
this.tagStatement = tagStatement;
22-
this.visualName = tagStatement.getKeyword() + ": " + tagStatement.getName();
19+
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement gherkinModel) {
20+
super(cucumberFeature, gherkinModel);
21+
this.gherkinModel = gherkinModel;
22+
this.visualName = gherkinModel.getKeyword() + ": " + gherkinModel.getName();
2323
}
2424

25-
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement tagStatement, Row example) {
26-
super(cucumberFeature, tagStatement);
27-
this.tagStatement = tagStatement;
25+
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement gherkinModel, Row example) {
26+
super(cucumberFeature, gherkinModel);
27+
this.gherkinModel = gherkinModel;
2828
this.visualName = "| " + join(example.getCells(), " | ") + " |";
2929
}
3030

3131
protected Set<Tag> tagsAndInheritedTags() {
3232
Set<Tag> tags = new HashSet<Tag>();
33-
tags.addAll(cucumberFeature.getFeature().getTags());
34-
tags.addAll(tagStatement.getTags());
33+
tags.addAll(cucumberFeature.getGherkinFeature().getTags());
34+
tags.addAll(gherkinModel.getTags());
3535
return tags;
3636
}
3737

3838
public String getVisualName() {
3939
return visualName;
4040
}
4141

42+
public TagStatement getGherkinModel() {
43+
return gherkinModel;
44+
}
4245

4346
public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime);
4447
}

core/src/test/java/cucumber/runtime/HookTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void after_hooks_execute_before_objects_are_disposed() throws Throwable {
3838
CucumberFeature feature = mock(CucumberFeature.class);
3939
Feature gherkinFeature = mock(Feature.class);
4040

41-
when(feature.getFeature()).thenReturn(gherkinFeature);
41+
when(feature.getGherkinFeature()).thenReturn(gherkinFeature);
4242
when(gherkinFeature.getTags()).thenReturn(new ArrayList<Tag>());
4343

4444
CucumberScenario scenario = new CucumberScenario(feature, null, gherkinScenario);

examples/java-helloworld/build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<property name="cucumber-jvm.version" value="1.1.1"/>
44
<property name="cucumber-html.version" value="0.2.2"/>
55
<property name="jchronic.version" value="0.2.6"/>
6-
<property name="junit.version" value="4.10"/>
6+
<property name="junit.version" value="4.11"/>
77

88
<property name="jars" value="lib"/>
99

examples/java-helloworld/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<dependency>
5555
<groupId>junit</groupId>
5656
<artifactId>junit</artifactId>
57-
<version>4.10</version>
57+
<version>4.11</version>
5858
<scope>test</scope>
5959
</dependency>
6060
</dependencies>

0 commit comments

Comments
 (0)