use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class GuiceStepsFactoryBehaviour method assertThatStepsCanBeCreated.
@Test
public void assertThatStepsCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
// Given
Injector parent = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(FooSteps.class).in(Scopes.SINGLETON);
}
});
AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class GuiceStepsFactoryBehaviour method assertThatStepsWithStepsWithDependencyCanBeCreated.
@Test
public void assertThatStepsWithStepsWithDependencyCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
Injector parent = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(Integer.class).toInstance(42);
bind(FooStepsWithDependency.class).in(Scopes.SINGLETON);
}
});
// When
AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
assertThat((int) ((FooStepsWithDependency) stepsInstance(steps.get(0))).integer, equalTo(42));
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class Embedder method reportMatchingStepdocs.
public void reportMatchingStepdocs(String stepAsString) {
Configuration configuration = configuration();
List<CandidateSteps> candidateSteps = candidateSteps();
StepFinder finder = configuration.stepFinder();
StepdocReporter reporter = configuration.stepdocReporter();
List<Stepdoc> matching = finder.findMatching(stepAsString, candidateSteps);
List<Object> stepsInstances = finder.stepsInstances(candidateSteps);
reporter.stepdocsMatching(stepAsString, matching, stepsInstances);
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class SpringStepsFactoryAOPBehaviour method aopEnvelopedStepsCanBeCreated.
@Test
public void aopEnvelopedStepsCanBeCreated() {
// Given
ApplicationContext context = createApplicationContext(StepsWithAOPAnnotationConfiguration.class.getName());
SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertAOPFooStepsFound(steps);
}
use of org.jbehave.core.steps.CandidateSteps in project jbehave-core by jbehave.
the class SpringStepsFactoryBehaviour method annotationStepsWithDependenciesCanBeCreated.
@Test
public void annotationStepsWithDependenciesCanBeCreated() {
// Given
ApplicationContext context = createApplicationContext(StepsWithDependencyAnnotationConfiguration.class.getName());
// 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