use of cucumber.runtime.FeatureBuilder in project cucumber-jvm by cucumber.
the class CucumberFeature method load.
public static List<CucumberFeature> load(ResourceLoader resourceLoader, List<String> featurePaths, final List<Object> filters) {
final List<CucumberFeature> cucumberFeatures = new ArrayList<CucumberFeature>();
final FeatureBuilder builder = new FeatureBuilder(cucumberFeatures);
for (String featurePath : featurePaths) {
if (featurePath.startsWith("@")) {
loadFromRerunFile(builder, resourceLoader, featurePath.substring(1), filters);
} else {
loadFromFeaturePath(builder, resourceLoader, featurePath, filters, false);
}
}
Collections.sort(cucumberFeatures, new CucumberFeatureUriComparator());
return cucumberFeatures;
}
use of cucumber.runtime.FeatureBuilder in project cucumber-jvm by cucumber.
the class TestFeatureBuilder method feature.
static CucumberFeature feature(final String path, final String source) throws IOException {
ArrayList<CucumberFeature> cucumberFeatures = new ArrayList<CucumberFeature>();
FeatureBuilder featureBuilder = new FeatureBuilder(cucumberFeatures);
featureBuilder.parse(new Resource() {
@Override
public String getPath() {
return path;
}
@Override
public String getAbsolutePath() {
throw new UnsupportedOperationException();
}
@Override
public InputStream getInputStream() {
try {
return new ByteArrayInputStream(source.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
@Override
public String getClassName(String extension) {
throw new UnsupportedOperationException();
}
}, new ArrayList<Object>());
featureBuilder.close();
return cucumberFeatures.get(0);
}
use of cucumber.runtime.FeatureBuilder in project cucumber-jvm by cucumber.
the class StepdefGeneratorTest method features.
private List<CucumberFeature> features() throws IOException {
List<CucumberFeature> features = new ArrayList<CucumberFeature>();
FeatureBuilder fb = new FeatureBuilder(features);
fb.parse(new Resource() {
@Override
public String getPath() {
return "test.feature";
}
@Override
public String getAbsolutePath() {
throw new UnsupportedOperationException();
}
@Override
public InputStream getInputStream() {
try {
return new ByteArrayInputStream(("" + "Feature: Test\n" + " Scenario: Test\n" + " Given I have 4 cukes in my belly\n" + " And I have 3 bananas in my basket\n" + " Given I have 42 cukes in my belly\n").getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
@Override
public String getClassName(String extension) {
throw new UnsupportedOperationException();
}
}, emptyList());
return features;
}
Aggregations