cucumber.runtime.FeatureBuilder Maven / Gradle / Ivy
package cucumber.runtime;
import cucumber.io.Resource;
import cucumber.runtime.model.CucumberFeature;
import gherkin.I18n;
import gherkin.formatter.FilterFormatter;
import gherkin.formatter.Formatter;
import gherkin.formatter.model.Background;
import gherkin.formatter.model.Examples;
import gherkin.formatter.model.Feature;
import gherkin.formatter.model.Scenario;
import gherkin.formatter.model.ScenarioOutline;
import gherkin.formatter.model.Step;
import gherkin.parser.Parser;
import gherkin.util.FixJava;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FeatureBuilder implements Formatter {
private static final Charset UTF8 = Charset.forName("UTF-8");
private final List cucumberFeatures;
private final MessageDigest md5;
private CucumberFeature currentCucumberFeature;
private String uri;
private Map pathsByChecksum = new HashMap();
public FeatureBuilder(List cucumberFeatures) {
this.cucumberFeatures = cucumberFeatures;
try {
this.md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new CucumberException(e);
}
}
@Override
public void uri(String uri) {
this.uri = uri;
}
@Override
public void feature(Feature feature) {
currentCucumberFeature = new CucumberFeature(feature, uri);
cucumberFeatures.add(currentCucumberFeature);
}
@Override
public void background(Background background) {
currentCucumberFeature.background(background);
}
@Override
public void scenario(Scenario scenario) {
currentCucumberFeature.scenario(scenario);
}
@Override
public void scenarioOutline(ScenarioOutline scenarioOutline) {
currentCucumberFeature.scenarioOutline(scenarioOutline);
}
@Override
public void examples(Examples examples) {
currentCucumberFeature.examples(examples);
}
@Override
public void step(Step step) {
currentCucumberFeature.step(step);
}
@Override
public void eof() {
}
@Override
public void syntaxError(String state, String event, List legalEvents, String uri, int line) {
}
@Override
public void done() {
}
@Override
public void close() {
}
public void parse(Resource resource, List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy