@Test public void shouldEnrichFeatureWithCommentAndDocstring() { List<Feature> features = FeatureParser.parse(getClass().getResource("/com/github/cukedoctor/json-output/calc-enriched.json").getPath()); assertThat(features).isNotNull().hasSize(1); String output = new CukedoctorFeatureRenderer((DocumentAttributes) null).renderFeatures(features, CukedoctorDocumentBuilder.Factory.newInstance().createNestedBuilder()); assertThat(output.replaceAll("\r", "")).contains(("[[Calculator, Calculator]]" + newLine() + "=== *Calculator*" + newLine() + "" + newLine() + "==== Scenario: Adding numbers" + newLine() + "You can *asciidoc markup* in _feature_ #description#." + newLine() + "" + newLine() + "NOTE: This is a very important feature!" + newLine() + "" + newLine() + "==========" + newLine() + "Given ::" + newLine() + "I have numbers 1 and 2 icon:thumbs-up[role=\"green\",title=\"Passed\"] [small right]#(212ms)#" + newLine() + "" + newLine() + "IMPORTANT: Asciidoc markup inside *steps* must be surrounded by *curly brackets*." + newLine() + "" + newLine() + "When ::" + newLine() + "I sum the numbers using the following java code: icon:thumbs-up[role=\"green\",title=\"Passed\"] [small right]#(001ms)#" + newLine() + "******" + newLine() + "" + newLine() + "[discrete]" + newLine() + "[source,java]" + newLine() + "----" + newLine() + " public class Calc {" + newLine() + " public long sum(int x, int y){" + newLine() + " return x + y; " }" + newLine() + " }" + newLine() + "----" + newLine() + "[discrete]" + newLine() + "<1> This is an asciidoc call inside a feature." + newLine() + "" + newLine() + "" + newLine() + "******" + newLine() + "" + newLine() + "NOTE: You can use asciidoc in doc strings as well" + newLine() + "" + newLine() + "TIP: Steps comments are placed *before* each steps" + newLine() + "" + newLine() + "Then ::" + newLine() + "I should have 3 as result icon:thumbs-up[role=\"green\",title=\"Passed\"] [small right]#(003ms)#" + newLine() + "" + newLine() + "* this is a list of itens inside a feature step" + newLine() + "" + newLine() + "* there is no multiline comment in gherkin" + newLine() + "" + newLine() + "** second level list item" + newLine() + "" + newLine() + "==========" + newLine() + "" + newLine() + "").replaceAll("\r", "")); }
@Override public String renderFeatures(List<Feature> features) { docBuilder.clear(); if(!cukedoctorConfig.isHideFeaturesSection()) { docBuilder.titleThenNest(bold(i18n.getMessage("title.features"))).newLine(); } for (Feature feature : features) { docBuilder.append(renderFeature(feature)); } return docBuilder.toString(); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeatures(List<Feature> features) { docBuilder.clear(); if(!cukedoctorConfig.isHideFeaturesSection()) { docBuilder.titleThenNest(bold(i18n.getMessage("title.features"))).newLine(); } for (Feature feature : features) { docBuilder.append(renderFeature(feature)); } return docBuilder.toString(); } }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeatures(List<Feature> features) { docBuilder.clear(); if(!cukedoctorConfig.isHideFeaturesSection()) { docBuilder.titleThenNest(bold(i18n.getMessage("title.features"))).newLine(); } for (Feature feature : features) { docBuilder.append(renderFeature(feature)); } return docBuilder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeatures(List<Feature> features) { docBuilder.clear(); if(!cukedoctorConfig.isHideFeaturesSection()) { docBuilder.titleThenNest(bold(i18n.getMessage("title.features"))).newLine(); } for (Feature feature : features) { docBuilder.append(renderFeature(feature)); } return docBuilder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); @Override String renderFeature(Feature feature); @Override String renderFeatures(List<Feature> features); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeatures(List<Feature> features) { docBuilder.clear(); if(!cukedoctorConfig.isHideFeaturesSection()) { docBuilder.titleThenNest(bold(i18n.getMessage("title.features"))).newLine(); } for (Feature feature : features) { docBuilder.append(renderFeature(feature)); } return docBuilder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); @Override String renderFeature(Feature feature); @Override String renderFeatures(List<Feature> features);  }