Skip to content

Commit

Permalink
Updated to JUnit 4.11. Relates to cucumber#255. Might also relate to c…
Browse files Browse the repository at this point in the history
…ucumber#322. IntelliJ IDEA reports features with Background and Scenario Outline incorrect.y. Might be the case on master too.
  • Loading branch information
aslakhellesoy committed Jan 12, 2013
1 parent 465a2c4 commit 8cb7618
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 641 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ See [Contributing](http://cukes.info/contribute.html) as well as (https://github

## Coming from Cuke4Duke?

See [Migration from Cuke4Duke](https://github.com/cucumber/cucumber-jvm/blob/master/Cuke4Duke.md)
See [Migration from Cuke4Duke](https://github.com/cucumber/cucumber-jvm/blob/master/Cuke4Duke.md)
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void step(Step step) {
currentStepContainer.step(step);
}

public Feature getFeature() {
public Feature getGherkinFeature() {
return feature;
}

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

public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
formatter.uri(getUri());
formatter.feature(getFeature());
formatter.feature(getGherkinFeature());

for (CucumberTagStatement cucumberTagStatement : getFeatureElements()) {
//Run the scenario, it should handle before and after hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
}

CucumberScenario createExampleScenario(ExamplesTableRow header, ExamplesTableRow example, List<Tag> examplesTags) {
Scenario exampleScenario = new Scenario(example.getComments(), examplesTags, tagStatement.getKeyword(), tagStatement.getName(), "", example.getLine(), example.getId());
Scenario exampleScenario = new Scenario(example.getComments(), examplesTags, getGherkinModel().getKeyword(), getGherkinModel().getName(), "", example.getLine(), example.getId());
CucumberScenario cucumberScenario = new CucumberScenario(cucumberFeature, cucumberBackground, exampleScenario, example);
for (Step step : getSteps()) {
cucumberScenario.step(createExampleStep(step, header, example));
Expand Down
23 changes: 13 additions & 10 deletions core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,35 @@
import static gherkin.util.FixJava.join;

public abstract class CucumberTagStatement extends StepContainer {
final TagStatement tagStatement;
private final TagStatement gherkinModel;
private final String visualName;

CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement tagStatement) {
super(cucumberFeature, tagStatement);
this.tagStatement = tagStatement;
this.visualName = tagStatement.getKeyword() + ": " + tagStatement.getName();
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement gherkinModel) {
super(cucumberFeature, gherkinModel);
this.gherkinModel = gherkinModel;
this.visualName = gherkinModel.getKeyword() + ": " + gherkinModel.getName();
}

CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement tagStatement, Row example) {
super(cucumberFeature, tagStatement);
this.tagStatement = tagStatement;
CucumberTagStatement(CucumberFeature cucumberFeature, TagStatement gherkinModel, Row example) {
super(cucumberFeature, gherkinModel);
this.gherkinModel = gherkinModel;
this.visualName = "| " + join(example.getCells(), " | ") + " |";
}

protected Set<Tag> tagsAndInheritedTags() {
Set<Tag> tags = new HashSet<Tag>();
tags.addAll(cucumberFeature.getFeature().getTags());
tags.addAll(tagStatement.getTags());
tags.addAll(cucumberFeature.getGherkinFeature().getTags());
tags.addAll(gherkinModel.getTags());
return tags;
}

public String getVisualName() {
return visualName;
}

public TagStatement getGherkinModel() {
return gherkinModel;
}

public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime);
}
2 changes: 1 addition & 1 deletion core/src/test/java/cucumber/runtime/HookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void after_hooks_execute_before_objects_are_disposed() throws Throwable {
CucumberFeature feature = mock(CucumberFeature.class);
Feature gherkinFeature = mock(Feature.class);

when(feature.getFeature()).thenReturn(gherkinFeature);
when(feature.getGherkinFeature()).thenReturn(gherkinFeature);
when(gherkinFeature.getTags()).thenReturn(new ArrayList<Tag>());

CucumberScenario scenario = new CucumberScenario(feature, null, gherkinScenario);
Expand Down
2 changes: 1 addition & 1 deletion examples/java-helloworld/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<property name="cucumber-jvm.version" value="1.1.1"/>
<property name="cucumber-html.version" value="0.2.2"/>
<property name="jchronic.version" value="0.2.6"/>
<property name="junit.version" value="4.10"/>
<property name="junit.version" value="4.11"/>

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

Expand Down
2 changes: 1 addition & 1 deletion examples/java-helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit 8cb7618

Please sign in to comment.