Search in sources :

Example 26 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class ConfigurationProducer method getConfiguration.

@Produces
@WeldConfiguration
public Configuration getConfiguration() {
    LoadFromClasspath resourceLoader = new LoadFromClasspath(getClass().getClassLoader());
    TableTransformers tableTransformers = new TableTransformers();
    return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(false).doSkipScenariosAfterFailure(false)).useStoryLoader(resourceLoader).useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(CONSOLE, HTML, TXT, XML)).useParameterConverters(new ParameterConverters(resourceLoader, tableTransformers).addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))).useTableTransformers(tableTransformers);
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) DateConverter(org.jbehave.core.steps.ParameterConverters.DateConverter) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ParameterConverters(org.jbehave.core.steps.ParameterConverters) StoryControls(org.jbehave.core.embedder.StoryControls) SimpleDateFormat(java.text.SimpleDateFormat) TableTransformers(org.jbehave.core.model.TableTransformers) Produces(javax.enterprise.inject.Produces) WeldConfiguration(org.jbehave.core.annotations.weld.WeldConfiguration)

Example 27 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class PicoAnnotationBuilderBehaviour method shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent.

@Test
public void shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent() {
    PicoAnnotationBuilder builderNotAnnotated = new PicoAnnotationBuilder(NotAnnotated.class);
    assertThatConfigurationIs(builderNotAnnotated.buildConfiguration(), new MostUsefulConfiguration());
    PicoAnnotationBuilder builderAnnotatedWithoutLocations = new PicoAnnotationBuilder(AnnotatedWithoutModules.class);
    assertThatConfigurationIs(builderAnnotatedWithoutLocations.buildConfiguration(), new MostUsefulConfiguration());
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Example 28 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class PicoStepsFactoryBehaviour method assertThatStepsWithMissingDependenciesCannotBeCreated.

@Test(expected = AbstractInjector.UnsatisfiableDependenciesException.class)
public void assertThatStepsWithMissingDependenciesCannotBeCreated() throws NoSuchFieldException, IllegalAccessException {
    MutablePicoContainer parent = createPicoContainer();
    parent.as(Characteristics.USE_NAMES).addComponent(FooStepsWithDependency.class);
    PicoStepsFactory factory = new PicoStepsFactory(new MostUsefulConfiguration(), parent);
    // When
    factory.createInstanceOfType(FooStepsWithDependency.class);
// Then ... expected exception is thrown
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Example 29 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class PicoStepsFactoryBehaviour method assertThatStepsWithStepsWithDependencyCanBeCreated.

@Test
public void assertThatStepsWithStepsWithDependencyCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
    MutablePicoContainer parent = createPicoContainer();
    parent.as(Characteristics.USE_NAMES).addComponent(FooStepsWithDependency.class);
    parent.addComponent(Integer.class, 42);
    // When
    PicoStepsFactory factory = new PicoStepsFactory(new MostUsefulConfiguration(), parent);
    List<CandidateSteps> steps = factory.createCandidateSteps();
    // Then
    assertFooStepsFound(steps);
    assertThat((int) ((FooStepsWithDependency) stepsInstance(steps.get(0))).integer, equalTo(42));
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) CandidateSteps(org.jbehave.core.steps.CandidateSteps) Test(org.junit.Test)

Example 30 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class SpringStepsFactoryBehaviour method stepsWithMissingDependenciesCannotBeCreated.

@Test(expected = BeanDefinitionStoreException.class)
public void stepsWithMissingDependenciesCannotBeCreated() {
    // Given
    ApplicationContext context = createApplicationContext("org/jbehave/core/steps/spring/steps-with-missing-depedency.xml");
    SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
    // When
    factory.createCandidateSteps();
// Then ... expected exception is thrown
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)66 Test (org.junit.Test)52 Configuration (org.jbehave.core.configuration.Configuration)14 CandidateSteps (org.jbehave.core.steps.CandidateSteps)14 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)11 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)8 TableTransformers (org.jbehave.core.model.TableTransformers)8 Method (java.lang.reflect.Method)7 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)7 ParameterConverters (org.jbehave.core.steps.ParameterConverters)7 SimpleDateFormat (java.text.SimpleDateFormat)5 HashMap (java.util.HashMap)5 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)5 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)5 BeforeOrAfterFailed (org.jbehave.core.failures.BeforeOrAfterFailed)5 Failed (org.jbehave.core.steps.AbstractStepResult.Failed)5 ApplicationContext (org.springframework.context.ApplicationContext)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 OutputStream (java.io.OutputStream)4 PrintStream (java.io.PrintStream)4