-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failing test. Format code. Convert CRLF to LF.
- Loading branch information
1 parent
f950be5
commit 8ab1977
Showing
6 changed files
with
68 additions
and
63 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
79 changes: 38 additions & 41 deletions
79
junit/src/test/java/cucumber/junit/ExecutionUnitRunnerTest.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 |
---|---|---|
@@ -1,41 +1,38 @@ | ||
package cucumber.junit; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import gherkin.formatter.model.Step; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
import cucumber.io.ClasspathResourceLoader; | ||
import cucumber.runtime.model.CucumberFeature; | ||
import cucumber.runtime.model.CucumberScenario; | ||
|
||
public class ExecutionUnitRunnerTest { | ||
@Test | ||
public void shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario() throws Exception { | ||
List<CucumberFeature> features = | ||
CucumberFeature.load( | ||
new ClasspathResourceLoader(this.getClass().getClassLoader()), | ||
Arrays.asList(new String[] { "cucumber/junit/feature_with_same_steps_in_scenario.feature" }), | ||
Collections.emptyList()); | ||
|
||
ExecutionUnitRunner runner = | ||
new ExecutionUnitRunner( | ||
null, | ||
(CucumberScenario)features.get(0).getFeatureElements().get(0), | ||
null); | ||
|
||
// fish out the two occurrences of the same step and check whether we really got them | ||
Step stepOccurrence1 = runner.getChildren().get(0); | ||
Step stepOccurrence2 = runner.getChildren().get(2); | ||
assertEquals(stepOccurrence1.getName(), stepOccurrence2.getName()); | ||
|
||
assertFalse("Descriptions must not be equal.", | ||
runner.describeChild(stepOccurrence1) | ||
.equals(runner.describeChild(stepOccurrence2))); | ||
} | ||
} | ||
package cucumber.junit; | ||
|
||
import cucumber.io.ClasspathResourceLoader; | ||
import cucumber.runtime.model.CucumberFeature; | ||
import cucumber.runtime.model.CucumberScenario; | ||
import gherkin.formatter.model.Step; | ||
import org.junit.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static java.util.Arrays.asList; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
|
||
public class ExecutionUnitRunnerTest { | ||
@Test | ||
public void shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario() throws Exception { | ||
List<CucumberFeature> features = CucumberFeature.load( | ||
new ClasspathResourceLoader(this.getClass().getClassLoader()), | ||
asList("cucumber/junit/feature_with_same_steps_in_scenario.feature"), | ||
Collections.emptyList() | ||
); | ||
|
||
ExecutionUnitRunner runner = new ExecutionUnitRunner( | ||
null, | ||
(CucumberScenario) features.get(0).getFeatureElements().get(0), | ||
null | ||
); | ||
|
||
// fish out the two occurrences of the same step and check whether we really got them | ||
Step stepOccurrence1 = runner.getChildren().get(0); | ||
Step stepOccurrence2 = runner.getChildren().get(2); | ||
assertEquals(stepOccurrence1.getName(), stepOccurrence2.getName()); | ||
|
||
assertFalse("Descriptions must not be equal.", runner.describeChild(stepOccurrence1).equals(runner.describeChild(stepOccurrence2))); | ||
} | ||
} |
23 changes: 10 additions & 13 deletions
23
junit/src/test/java/cucumber/junit/JUnitReporterTest.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
14 changes: 7 additions & 7 deletions
14
junit/src/test/resources/cucumber/junit/feature_with_same_steps_in_scenario.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Feature: Scenario with same step occurring twice | ||
Scenario: | ||
When foo | ||
Then bar | ||
When foo | ||
Then baz | ||
Feature: Scenario with same step occurring twice | ||
Scenario: | ||
When foo | ||
Then bar | ||
|
||
When foo | ||
Then baz |
Empty file.