use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class WeldAnnotationBuilderBehaviour method shouldBuildConfigurationFromAnnotationsUsingConfigureAndConverters.
@Test
public void shouldBuildConfigurationFromAnnotationsUsingConfigureAndConverters() {
AnnotationBuilder builderAnnotated = createBuilder(AnnotatedUsingConfigureAndConverters.class);
Configuration configuration = builderAnnotated.buildConfiguration();
assertThatCustomObjectIsConverted(configuration.parameterConverters());
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class WeldAnnotationBuilderBehaviour method shouldBuildCandidateStepsFromAnnotationsUsingWeld.
@Test
public void shouldBuildCandidateStepsFromAnnotationsUsingWeld() {
AnnotationBuilder builderAnnotated = createBuilder(AnnotatedUsingWeld.class);
Configuration configuration = builderAnnotated.buildConfiguration();
assertThatStepsInstancesAre(builderAnnotated.buildCandidateSteps(configuration), WeldStepBean.class);
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class NeedleAnnotationBuilderBehaviour method shouldBuildCandidateStepsFromAnnotationsUsingStepsAndNeedle.
@Test
public void shouldBuildCandidateStepsFromAnnotationsUsingStepsAndNeedle() {
final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedUsingStepsAndNeedle.class);
final Configuration configuration = builderAnnotated.buildConfiguration();
assertThatStepsInstancesAre(builderAnnotated.buildCandidateSteps(configuration), FooSteps.class);
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class SpringSecurityStories method configuration.
@Override
public Configuration configuration() {
Configuration configuration = new MostUsefulConfiguration();
configuration.useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(getClass())).withDefaultFormats().withFormats(CONSOLE, TXT, HTML, XML));
return configuration;
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldRunStoriesAsPathsInBatchIfBatchFlagIsSet.
@SuppressWarnings("unchecked")
@Test
public void shouldRunStoriesAsPathsInBatchIfBatchFlagIsSet() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls().doBatch(true);
OutputStream out = new ByteArrayOutputStream();
EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
List<? extends Class<? extends Embeddable>> embeddables = asList(MyStory.class, MyOtherEmbeddable.class);
Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
Configuration configuration = embedder.configuration();
InjectableStepsFactory stepsFactory = embedder.stepsFactory();
MetaFilter filter = embedder.metaFilter();
StoryPathResolver resolver = configuration.storyPathResolver();
List<String> storyPaths = new ArrayList<>();
Map<String, Story> stories = new HashMap<>();
for (Class<? extends Embeddable> embeddable : embeddables) {
String storyPath = resolver.resolve(embeddable);
storyPaths.add(storyPath);
Story story = mockStory(Meta.EMPTY);
stories.put(storyPath, story);
when(performableTree.storyOfPath(configuration, storyPath)).thenReturn(story);
when(story.getPath()).thenReturn(storyPath);
}
RunContext runContext = new RunContext(configuration, stepsFactory, monitor, filter, new BatchFailures());
when(performableTree.newRunContext(isA(Configuration.class), isA(InjectableStepsFactory.class), isA(EmbedderMonitor.class), isA(MetaFilter.class), isA(BatchFailures.class))).thenReturn(runContext);
for (String storyPath : storyPaths) {
doNothing().when(performableTree).perform(runContext, stories.get(storyPath));
}
// When
embedder.runStoriesAsPaths(storyPaths);
// Then
for (String storyPath : storyPaths) {
assertThat(out.toString(), containsString("Running story " + storyPath));
}
}
Aggregations