use of org.jbehave.core.configuration.Keywords in project jbehave-core by jbehave.
the class CustomCoreStories method configuration.
@Override
public Configuration configuration() {
Configuration configuration = super.configuration();
Properties viewResources = new Properties();
viewResources.put("reports", "ftl/custom-reports.ftl");
configuration.useViewGenerator(new FreemarkerViewGenerator(this.getClass()));
Keywords keywords = new LocalizedKeywords(new Locale("en"), "i18n/custom", "i18n/keywords", this.getClass().getClassLoader());
StoryReporterBuilder reporterBuilder = configuration.storyReporterBuilder().withKeywords(keywords).withViewResources(viewResources).withFormats(CustomHtmlOutput.FORMAT);
return configuration.useKeywords(keywords).useStepCollector(new MarkUnmatchedStepsAsPending(keywords)).useStoryParser(new RegexStoryParser(keywords)).useStoryReporterBuilder(reporterBuilder);
}
use of org.jbehave.core.configuration.Keywords in project jbehave-core by jbehave.
the class StepCandidateBehaviour method shouldNotMatchOrIgnoreStepWhenStartingWordNotFound.
@Test
public void shouldNotMatchOrIgnoreStepWhenStartingWordNotFound() throws Exception {
Method method = SomeSteps.class.getMethod("aMethod");
Keywords keywords = new LocalizedKeywords() {
@Override
public String startingWordFor(StepType stepType) {
throw new StartingWordNotFound(stepType, new HashMap<StepType, String>());
}
};
ParameterConverters parameterConverters = new ParameterConverters(new LoadFromClasspath(), new TableTransformers());
StepCandidate candidate = new StepCandidate("windows on the $nth floor", 0, WHEN, method, null, null, new StepsContext(), keywords, new RegexPrefixCapturingPatternParser(), parameterConverters, new ParameterControls());
assertThat(candidate.matches("When windows on the 1st floor"), is(false));
assertThat(candidate.ignore("!-- windows on the 1st floor"), is(false));
}
use of org.jbehave.core.configuration.Keywords in project jbehave-core by jbehave.
the class StepCreatorBehaviour method shouldCreatePendingAsStepResults.
@Test
public void shouldCreatePendingAsStepResults() {
// When
String stepAsString = "When I'm pending";
Step pendingStep = StepCreator.createPendingStep(stepAsString, null);
// Then
assertThat(pendingStep.asString(new Keywords()), equalTo(stepAsString));
assertThat(pendingStep.perform(null), instanceOf(Pending.class));
assertThat(pendingStep.doNotPerform(null), instanceOf(Pending.class));
}
use of org.jbehave.core.configuration.Keywords in project jbehave-core by jbehave.
the class StepCreatorBehaviour method shouldCreateCommentAsStepResults.
@Test
public void shouldCreateCommentAsStepResults() {
// When
String stepAsString = "!-- A comment";
Step comment = StepCreator.createComment(stepAsString);
// Then
assertThat(comment.asString(new Keywords()), equalTo(stepAsString));
assertThat(comment.perform(null), instanceOf(Comment.class));
assertThat(comment.doNotPerform(null), instanceOf(Comment.class));
}
use of org.jbehave.core.configuration.Keywords in project jbehave-core by jbehave.
the class StepCreatorBehaviour method shouldCreateIgnorableAsStepResults.
@Test
public void shouldCreateIgnorableAsStepResults() {
// When
String stepAsString = "!-- Then ignore me";
Step ignorableStep = StepCreator.createIgnorableStep(stepAsString);
// Then
assertThat(ignorableStep.asString(new Keywords()), equalTo(stepAsString));
assertThat(ignorableStep.perform(null), instanceOf(Ignorable.class));
assertThat(ignorableStep.doNotPerform(null), instanceOf(Ignorable.class));
}
Aggregations