List<? extends Class<? extends Embeddable>> embeddables = asList(MyStory.class, MyOtherEmbeddable.class);
Embedder embedder = embedderWith(runner, embedderControls, monitor);
final StoryReporter storyReporter = mock(StoryReporter.class);
Configuration configuration = new MostUsefulConfiguration() {
@Override
public StoryReporter storyReporter(String storyPath) {
return storyReporter;
}
};
embedder.useConfiguration(configuration);
List<CandidateSteps> candidateSteps = embedder.candidateSteps();
InjectableStepsFactory stepsFactory = embedder.stepsFactory();
StoryPathResolver resolver = configuration.storyPathResolver();
State beforeStories = mock(State.class);
when(runner.runBeforeOrAfterStories(configuration, candidateSteps, Stage.BEFORE)).thenReturn(beforeStories);
List<String> storyPaths = new ArrayList<String>();
Map<String, Story> stories = new HashMap<String, Story>();
Meta meta = mock(Meta.class);
for (Class<? extends Embeddable> embeddable : embeddables) {
String storyPath = resolver.resolve(embeddable);
storyPaths.add(storyPath);
Story story = mockStory(Meta.EMPTY);
when(story.getMeta()).thenReturn(meta);
stories.put(storyPath, story);
when(runner.storyOfPath(configuration, storyPath)).thenReturn(story);
assertThat(configuration.storyReporter(storyPath), sameInstance(storyReporter));
}
// When
MetaFilter filter = mock(MetaFilter.class);
when(filter.allow(meta)).thenReturn(false);