use of io.cucumber.messages.types.FeatureChild in project cucumber-jvm by cucumber.
the class TestSourcesModel method parseGherkinSource.
private void parseGherkinSource(URI path) {
if (!pathToReadEventMap.containsKey(path)) {
return;
}
String source = pathToReadEventMap.get(path).getSource();
List<Envelope> sources = singletonList(makeSourceEnvelope(source, path.toString()));
List<Envelope> envelopes = Gherkin.fromSources(sources, true, true, true, () -> String.valueOf(UUID.randomUUID())).collect(toList());
GherkinDocument gherkinDocument = envelopes.stream().map(Envelope::getGherkinDocument).filter(Objects::nonNull).findFirst().orElse(null);
pathToAstMap.put(path, gherkinDocument);
Map<Long, AstNode> nodeMap = new HashMap<>();
AstNode currentParent = new AstNode(gherkinDocument.getFeature(), null);
for (FeatureChild child : gherkinDocument.getFeature().getChildren()) {
processFeatureDefinition(nodeMap, child, currentParent);
}
pathToNodeMap.put(path, nodeMap);
}
Aggregations