@Test public void shouldGetFeaturesInOrder() { final Feature one = FeatureBuilder.instance().tag("@order-1").tag("@section-one").scenario(ScenarioBuilder.instance().name("Root").build()).build(); final Feature two = FeatureBuilder.instance().tag("order-2").tag("@section-two").tag("@subsection-one").scenario(ScenarioBuilder.instance().name("Root").build()).build(); final Feature three = FeatureBuilder.instance().tag("order-3").tag("@section-two").tag("@subsection-one").build(); final Feature four = FeatureBuilder.instance().tag("order-4").tag("@section-three").build(); final Feature five = FeatureBuilder.instance().tag("order-5").build(); final Feature six = FeatureBuilder.instance().tag("order-6").tag("@subsection-one").build(); final Feature seven = FeatureBuilder.instance().tag("order-7").tag("@appendix").tag("@section-four").tag("@subsection-one").scenario(ScenarioBuilder.instance().name("Root").build()).build(); final Feature eight = FeatureBuilder.instance().tag("order-8").tag("@appendix").tag("@section-five").build(); final DocumentSection root = new DocumentSection(); root.addFeatures(Arrays.asList(six, five, three, four, one, two, seven, eight)); assertThat(root.getFeatures()).containsExactly(one, two, three, four, five, six, seven, eight); }
@Override public Stream<Feature> getFeatures() { return buildDocument().flatMap(Section::getFeatures); }
DocumentSection implements Section { @Override public Stream<Feature> getFeatures() { return buildDocument().flatMap(Section::getFeatures); } }
DocumentSection implements Section { @Override public Stream<Feature> getFeatures() { return buildDocument().flatMap(Section::getFeatures); } DocumentSection();  DocumentSection(Iterable<Feature> features); }
DocumentSection implements Section { @Override public Stream<Feature> getFeatures() { return buildDocument().flatMap(Section::getFeatures); } DocumentSection();  DocumentSection(Iterable<Feature> features); @Override Section addFeature(Feature feature); @Override String render(CukedoctorDocumentBuilder docBuilder, I18nLoader i18n, DocumentAttributes documentAttributes); @Override int getOrder(); @Override Stream<Feature> getFeatures(); }
DocumentSection implements Section { @Override public Stream<Feature> getFeatures() { return buildDocument().flatMap(Section::getFeatures); } DocumentSection();  DocumentSection(Iterable<Feature> features); @Override Section addFeature(Feature feature); @Override String render(CukedoctorDocumentBuilder docBuilder, I18nLoader i18n, DocumentAttributes documentAttributes); @Override int getOrder(); @Override Stream<Feature> getFeatures();  }