Gherkin { public static Stream<Envelope> fromPaths(List<String> paths, boolean includeSource, boolean includeAst, boolean includePickles, IdGenerator idGenerator) { return new Gherkin(paths, null, includeSource, includeAst, includePickles, idGenerator).messages(); } private  Gherkin(List<String> paths, List<Envelope> envelopes, boolean includeSource, boolean includeAst, boolean includePickles, IdGenerator idGenerator); static Stream<Envelope> fromPaths(List<String> paths, boolean includeSource, boolean includeAst, boolean includePickles, IdGenerator idGenerator); static Stream<Envelope> fromSources(List<Envelope> envelopes, boolean includeSource, boolean includeAst, boolean includePickles, IdGenerator idGenerator); static Stream<Envelope> fromStream(InputStream in); static Envelope makeSourceEnvelope(String data, String uri); Stream<Envelope> messages();  }
@Test public void use_this_in_readme() { List<String> paths = singletonList("testdata/good/minimal.feature"); boolean includeSource = false; boolean includeAst = true; boolean includePickles = true; Stream<Envelope> envelopeStream = Gherkin.fromPaths(paths, includeSource, includeAst, includePickles, idGenerator); Stream<Envelope> pickleStream = envelopeStream.filter(Envelope::hasPickle); assertEquals("minimalistic", pickleStream.collect(Collectors.toList()).get(0).getPickle().getName()); }
@Test public void provides_access_to_the_ast() { List<String> paths = singletonList("testdata/good/minimal.feature"); boolean includeSource = false; boolean includeAst = true; boolean includePickles = false; List<Envelope> envelopes = Gherkin.fromPaths(paths, includeSource, includeAst, includePickles, idGenerator).collect(Collectors.toList()); GherkinDocument gherkinDocument = envelopes.get(0).getGherkinDocument(); GherkinDocument.Feature feature = gherkinDocument.getFeature(); assertEquals("Minimal", feature.getName()); GherkinDocument.Feature.Scenario scenario = feature.getChildren(0).getScenario(); assertEquals("minimalistic", scenario.getName()); }
@Test public void provides_access_to_pickles_which_are_compiled_from_the_ast() { List<Envelope> envelopes = Gherkin.fromPaths(singletonList("testdata/good/scenario_outline.feature"), false, false, true, idGenerator).collect(Collectors.toList()); Pickle pickle = envelopes.get(0).getPickle(); Pickle.PickleStep step = pickle.getSteps(0); assertEquals("the minimalism", step.getText()); }