@Test
public void shouldHandlePendingStepsAccordingToStrategy() throws Throwable {
// Given
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
Step pendingStep = mock(Step.class);
StepResult pendingResult = pending("My step isn't defined!");
when(pendingStep.perform(null)).thenReturn(pendingResult);
PendingStepStrategy strategy = mock(PendingStepStrategy.class);
StepCollector collector = mock(StepCollector.class);
CandidateSteps mySteps = new Steps();
when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
asList(pendingStep));
Story story = new Story(asList(new Scenario()));
givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);
// When
StoryRunner runner = new StoryRunner();
runner.run(configurationWithPendingStrategy(collector, reporter,
strategy), asList(mySteps), story);
// Then
verify(strategy).handleFailure(pendingResult.getFailure());
}