forked from cucumber/cucumber-jvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail if duplicate features are detected. Closes cucumber#165.
- Loading branch information
1 parent
8a9ede2
commit 894cf1c
Showing
3 changed files
with
60 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
core/src/test/java/cucumber/runtime/FeatureBuilderTest.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,30 @@ | ||
package cucumber.runtime; | ||
|
||
import cucumber.io.Resource; | ||
import cucumber.runtime.model.CucumberFeature; | ||
import org.junit.Test; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class FeatureBuilderTest { | ||
@Test(expected = CucumberException.class) | ||
public void detects_duplicate_features() throws IOException { | ||
List<CucumberFeature> fearures = new ArrayList<CucumberFeature>(); | ||
FeatureBuilder builder = new FeatureBuilder(fearures); | ||
Resource resource = mock(Resource.class); | ||
when(resource.getPath()).thenReturn("foo.feature"); | ||
ByteArrayInputStream firstFeature = new ByteArrayInputStream("Feature: foo".getBytes("UTF-8")); | ||
ByteArrayInputStream secondFeature = new ByteArrayInputStream("Feature: foo".getBytes("UTF-8")); | ||
when(resource.getInputStream()).thenReturn(firstFeature, secondFeature); | ||
builder.parse(resource, emptyList()); | ||
builder.parse(resource, emptyList()); | ||
} | ||
|
||
} |