use of org.jbehave.core.parsers.RegexPrefixCapturingPatternParser in project jbehave-core by jbehave.
the class StepCandidateBehaviour method candidateWith.
private StepCandidate candidateWith(String patternAsString, StepType stepType, Method method, Object instance, ParameterControls parameterControls) {
Class<?> stepsType = instance.getClass();
MostUsefulConfiguration configuration = new MostUsefulConfiguration();
InjectableStepsFactory stepsFactory = new InstanceStepsFactory(configuration, instance);
return new StepCandidate(patternAsString, 0, stepType, method, stepsType, stepsFactory, new StepsContext(), keywords, new RegexPrefixCapturingPatternParser(), configuration.parameterConverters(), parameterControls);
}
use of org.jbehave.core.parsers.RegexPrefixCapturingPatternParser in project jbehave-core by jbehave.
the class SpringAnnotationBuilderBehaviour method shouldBuildConfigurationFromAnnotations.
@Test
public void shouldBuildConfigurationFromAnnotations() {
SpringAnnotationBuilder builder = new SpringAnnotationBuilder(AnnotatedUsingSpring.class);
Configuration configuration = builder.buildConfiguration();
assertThat(configuration.storyControls().dryRun(), is(true));
assertThat(configuration.storyControls().skipScenariosAfterFailure(), is(true));
assertThat(configuration.failureStrategy(), instanceOf(SilentlyAbsorbingFailure.class));
assertThat(configuration.storyLoader(), instanceOf(LoadFromURL.class));
assertThat(configuration.stepPatternParser(), instanceOf(RegexPrefixCapturingPatternParser.class));
assertThat(((RegexPrefixCapturingPatternParser) configuration.stepPatternParser()).getPrefix(), equalTo("MyPrefix"));
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
assertThat(configuration.parameterControls().nameDelimiterLeft(), equalTo("["));
assertThat(configuration.parameterControls().nameDelimiterRight(), equalTo("]"));
assertThat(configuration.storyReporterBuilder().formats(), hasItems(CONSOLE, HTML, TXT, XML, STATS));
Keywords keywords = configuration.storyReporterBuilder().keywords();
assertThat(keywords, instanceOf(LocalizedKeywords.class));
assertThat(((LocalizedKeywords) keywords).getLocale(), equalTo(Locale.ITALIAN));
assertThat(configuration.storyReporterBuilder().outputDirectory().getName(), equalTo("my-output-directory"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("index"), equalTo("my-reports-index.ftl"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("decorateNonHtml"), equalTo("true"));
assertThat(configuration.storyReporterBuilder().reportFailureTrace(), is(true));
}
use of org.jbehave.core.parsers.RegexPrefixCapturingPatternParser in project jbehave-core by jbehave.
the class ConfigurationProducer method getConfiguration.
@Produces
@WeldConfiguration
Configuration getConfiguration() {
Properties viewResources = new Properties();
viewResources.setProperty("index", "my-reports-index.ftl");
viewResources.setProperty("decorateNonHtml", "true");
TableTransformers tableTransformers = new TableTransformers();
LoadFromURL resourceLoader = new LoadFromURL();
return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(true).doSkipScenariosAfterFailure(true)).useFailureStrategy(new SilentlyAbsorbingFailure()).useStoryLoader(resourceLoader).useStepPatternParser(new RegexPrefixCapturingPatternParser("MyPrefix")).useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(CONSOLE, HTML, TXT, XML).withKeywords(new LocalizedKeywords(Locale.ITALIAN)).withRelativeDirectory("my-output-directory").withViewResources(viewResources).withFailureTrace(true)).useParameterConverters(new ParameterConverters(resourceLoader, tableTransformers).addConverters(new CustomConverter(), new MyDateConverter())).useTableTransformers(tableTransformers);
}
Aggregations