use of org.jbehave.core.steps.ParameterControls in project jbehave-core by jbehave.
the class CoreStory method configuration.
@Override
public Configuration configuration() {
Class<? extends Embeddable> embeddableClass = this.getClass();
Properties viewResources = new Properties();
viewResources.put("decorateNonHtml", "true");
LoadFromClasspath resourceLoader = new LoadFromClasspath(embeddableClass);
TableTransformers tableTransformers = new TableTransformers();
ParameterControls parameterControls = new ParameterControls();
// Start from default ParameterConverters instance
ParameterConverters parameterConverters = new ParameterConverters(resourceLoader, tableTransformers);
// factory to allow parameter conversion and loading from external
// resources (used by StoryParser too)
ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), resourceLoader, parameterConverters, parameterControls, tableTransformers);
// add custom converters
parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")), new ExamplesTableConverter(examplesTableFactory));
return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(false).doSkipScenariosAfterFailure(false)).useStoryLoader(resourceLoader).useStoryParser(new RegexStoryParser(examplesTableFactory)).useStoryPathResolver(new UnderscoredCamelCaseResolver()).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass)).withDefaultFormats().withPathResolver(new ResolveToPackagedName()).withViewResources(viewResources).withFormats(CONSOLE, TXT, HTML_TEMPLATE, XML).withCrossReference(xref).withFailureTrace(true).withFailureTraceCompression(true)).useParameterConverters(parameterConverters).useParameterControls(parameterControls).useTableTransformers(tableTransformers);
}
use of org.jbehave.core.steps.ParameterControls in project jbehave-core by jbehave.
the class ExamplesTableBehaviour method shouldParseTableWithDifferentSeparators.
@Test
public void shouldParseTableWithDifferentSeparators() {
String headerSeparator = "||";
String valueSeparator = "|";
String tableWithCustomSeparator = wikiTableAsString;
TableTransformers tableTransformers = new TableTransformers();
ParameterControls parameterControls = new ParameterControls();
ParameterConverters parameterConverters = new ParameterConverters(new LoadFromClasspath(), parameterControls, tableTransformers, true);
ExamplesTable table = new ExamplesTable(tableWithCustomSeparator, headerSeparator, valueSeparator, parameterConverters, parameterControls, tableTransformers);
assertThat(table.getHeaderSeparator(), equalTo(headerSeparator));
assertThat(table.getValueSeparator(), equalTo(valueSeparator));
ensureColumnOrderIsPreserved(table);
assertThat(table.asString(), equalTo(tableWithCustomSeparator));
}
Aggregations