use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class SpringStepsFactoryBehaviour method annotationStepsCanBeCreated.
@Test
public void annotationStepsCanBeCreated() throws Exception {
// Given
ApplicationContext context = createApplicationContext(StepsAnnotationConfiguration.class.getName());
SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class NeedleAnnotationBuilderBehaviour method shouldSupplyInjectors.
@Test
public void shouldSupplyInjectors() {
final NeedleAnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedWithStepsWithDependency.class);
final List<CandidateSteps> buildCandidateSteps = builderAnnotated.buildCandidateSteps();
assertThatStepsInstancesAre(buildCandidateSteps, FooStepsWithDependency.class);
final ValueGetter getter = ((FooStepsWithDependency) ((Steps) buildCandidateSteps.get(0)).instance()).getGetter();
assertThat(getter, is(notNullValue()));
assertThat((String) getter.getValue(), is(ValueGetter.VALUE));
}
use of org.jbehave.core.steps.CandidateSteps in project serenity-jbehave by serenity-bdd.
the class SerenityReportingRunner method buildCandidateSteps.
private List<CandidateSteps> buildCandidateSteps() {
List<CandidateSteps> candidateSteps;
InjectableStepsFactory stepsFactory = configurableEmbedder.stepsFactory();
if (stepsFactory != null) {
candidateSteps = stepsFactory.createCandidateSteps();
} else {
Embedder embedder = getConfiguredEmbedder();
candidateSteps = embedder.candidateSteps();
if (candidateSteps == null || candidateSteps.isEmpty()) {
candidateSteps = embedder.stepsFactory().createCandidateSteps();
}
}
return candidateSteps;
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldReportNoMatchingStepdocsFoundWhenNoStepsProvided.
@Test
public void shouldReportNoMatchingStepdocsFoundWhenNoStepsProvided() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList(new CandidateSteps[] {}));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a non-defined step");
// Then
String expected = "Step 'Given a non-defined step' is not matched by any pattern\n" + "as no steps instances are provided\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldFindAndReportMatchingSteps.
@Test
public void shouldFindAndReportMatchingSteps() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a given");
// Then
String expected = "Step 'Given a given' is matched by annotated patterns:\n" + "'Given a given'\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.given()\n" + "from steps instances:\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
Aggregations