use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class GuiceAnnotationBuilderBehaviour method shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent.
@Test
public void shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent() {
AnnotationBuilder builderNotAnnotated = new GuiceAnnotationBuilder(NotAnnotated.class);
assertThatConfigurationIs(builderNotAnnotated.buildConfiguration(), new MostUsefulConfiguration());
AnnotationBuilder builderAnnotatedWithoutModules = new GuiceAnnotationBuilder(AnnotatedWithoutModules.class);
assertThatConfigurationIs(builderAnnotatedWithoutModules.buildConfiguration(), new MostUsefulConfiguration());
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class InstanceStepsFactoryBehaviour method shouldAllowGenericList.
@Test
public void shouldAllowGenericList() {
List<? super MyInterface> list = new ArrayList<>();
list.add(new MyStepsAWithInterface());
list.add(new MyStepsBWithInterface());
InstanceStepsFactory factory = new InstanceStepsFactory(new MostUsefulConfiguration(), list);
List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
assertThat(candidateSteps.size(), equalTo(2));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class GuiceStepsFactoryBehaviour method assertThatStepsWithMissingDependenciesCannotBeCreated.
@Test(expected = CreationException.class)
public void assertThatStepsWithMissingDependenciesCannotBeCreated() throws NoSuchFieldException, IllegalAccessException {
Injector parent = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(FooStepsWithDependency.class);
}
});
AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
// When
factory.createCandidateSteps();
// Then ... expected exception is thrown
}
use of org.jbehave.core.configuration.MostUsefulConfiguration 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.configuration.MostUsefulConfiguration 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));
}
Aggregations