use of org.jbehave.core.io.StoryPathResolver in project jbehave-core by jbehave.
the class ConfigurableEmbedderBehaviour method shouldAllowOverrideOfDefaultConfiguration.
@Test
public void shouldAllowOverrideOfDefaultConfiguration() throws Throwable {
// Given
Embedder embedder = mock(Embedder.class);
Configuration configuration = mock(Configuration.class);
StoryPathResolver pathResolver = mock(StoryPathResolver.class);
when(embedder.configuration()).thenReturn(configuration);
when(configuration.storyPathResolver()).thenReturn(pathResolver);
Class<MyStory> storyClass = MyStory.class;
String storyPath = "/path/to/story";
when(pathResolver.resolve(storyClass)).thenReturn(storyPath);
CandidateSteps steps = mock(CandidateSteps.class);
// When
MyStory story = new MyStory(new MostUsefulConfiguration(), steps);
assertThat(story.configuration(), is(not(sameInstance(configuration))));
story.useConfiguration(configuration);
assertThat(story.configuration(), is(sameInstance(configuration)));
story.useEmbedder(embedder);
story.run();
// Then
verify(embedder).useConfiguration(configuration);
verify(embedder).useCandidateSteps(Mockito.eq(Arrays.asList(steps)));
verify(embedder).runStoriesAsPaths(asList(storyPath));
}
use of org.jbehave.core.io.StoryPathResolver in project jbehave-core by jbehave.
the class ConfigurableEmbedderBehaviour method shouldRunASingleStory.
@Test
public void shouldRunASingleStory() throws Throwable {
// Given
Embedder embedder = mock(Embedder.class);
Configuration configuration = mock(Configuration.class);
StoryPathResolver pathResolver = mock(StoryPathResolver.class);
when(embedder.configuration()).thenReturn(configuration);
when(configuration.storyPathResolver()).thenReturn(pathResolver);
Class<MyStory> storyClass = MyStory.class;
String storyPath = "/path/to/story";
when(pathResolver.resolve(storyClass)).thenReturn(storyPath);
CandidateSteps steps = mock(CandidateSteps.class);
// When
MyStory story = new MyStory(configuration, steps);
story.useEmbedder(embedder);
story.run();
// Then
verify(embedder).useConfiguration(configuration);
verify(embedder).useCandidateSteps(eq(asList(steps)));
verify(embedder).runStoriesAsPaths(asList(storyPath));
}
Aggregations