use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class NeedleStepsFactory method createCandidateSteps.
/**
* {@inheritDoc}
*/
public List<CandidateSteps> createCandidateSteps() {
final List<CandidateSteps> result = new ArrayList<>();
for (final Class<?> type : steps) {
if (hasAnnotatedMethods(type)) {
configuration.parameterConverters().addConverters(methodReturningConverters(type));
result.add(new Steps(configuration, type, this));
}
}
return result;
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class NeedleAnnotationBuilderBehaviour method assertThatStepsInstancesAre.
private void assertThatStepsInstancesAre(final List<CandidateSteps> candidateSteps, final Class<?>... stepsClasses) {
assertThat(candidateSteps.size(), equalTo(stepsClasses.length));
// transform candidateSteps to Set of classes
final Set<Class<?>> candidateStepClasses = new HashSet<>();
for (final CandidateSteps step : candidateSteps) {
candidateStepClasses.add(((Steps) step).instance().getClass());
}
assertThat(candidateStepClasses, hasItems(stepsClasses));
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class NeedleAnnotationBuilderBehaviour method shouldBuildStepsList.
@Test
public void shouldBuildStepsList() {
final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedMultipleSteps.class);
final List<CandidateSteps> actual = builderAnnotated.buildCandidateSteps();
assertThatStepsInstancesAre(actual, FooStepsWithDependency.class, FooSteps.class);
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class SpringStepsFactoryBehaviour method stepsCanBeCreated.
@Test
public void stepsCanBeCreated() {
// Given
ApplicationContext context = createApplicationContext("org/jbehave/core/steps/spring/steps.xml");
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 SpringStepsFactoryBehaviour method stepsWithDependenciesCanBeCreated.
@Test
public void stepsWithDependenciesCanBeCreated() {
// Given
ApplicationContext context = createApplicationContext("org/jbehave/core/steps/spring/steps-with-dependency.xml");
// When
SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
assertThat((int) findInstanceOfType(steps, FooStepsWithDependency.class).integer, equalTo(42));
}
Aggregations