| 1 | |
package org.jbehave.core.reporters; |
| 2 | |
|
| 3 | |
import org.jbehave.core.failures.UUIDExceptionWrapper; |
| 4 | |
import org.jbehave.core.failures.StepFailed; |
| 5 | |
import org.jbehave.core.model.*; |
| 6 | |
|
| 7 | |
import java.util.List; |
| 8 | |
import java.util.Map; |
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
public class StepFailureDecorator implements StoryReporter { |
| 21 | |
|
| 22 | |
private final StoryReporter delegate; |
| 23 | |
private UUIDExceptionWrapper failure; |
| 24 | |
|
| 25 | 3 | public StepFailureDecorator(StoryReporter delegate) { |
| 26 | 3 | this.delegate = delegate; |
| 27 | 3 | } |
| 28 | |
|
| 29 | |
public void afterScenario() { |
| 30 | 1 | delegate.afterScenario(); |
| 31 | 1 | } |
| 32 | |
|
| 33 | |
public void afterStory(boolean givenStory) { |
| 34 | 2 | delegate.afterStory(givenStory); |
| 35 | 2 | if (failure != null) { |
| 36 | 1 | throw failure; |
| 37 | |
} |
| 38 | 1 | } |
| 39 | |
|
| 40 | |
public void beforeScenario(String scenarioTitle) { |
| 41 | 1 | delegate.beforeScenario(scenarioTitle); |
| 42 | 1 | } |
| 43 | |
|
| 44 | |
public void scenarioMeta(Meta meta) { |
| 45 | 0 | delegate.scenarioMeta(meta); |
| 46 | 0 | } |
| 47 | |
|
| 48 | |
public void beforeStory(Story story, boolean givenStory) { |
| 49 | 1 | failure = null; |
| 50 | 1 | delegate.beforeStory(story, givenStory); |
| 51 | 1 | } |
| 52 | |
|
| 53 | |
public void narrative(Narrative narrative) { |
| 54 | 0 | delegate.narrative(narrative); |
| 55 | 0 | } |
| 56 | |
|
| 57 | |
public void failed(String step, Throwable cause) { |
| 58 | 2 | failure = (UUIDExceptionWrapper) cause; |
| 59 | 2 | delegate.failed(step, failure); |
| 60 | 2 | } |
| 61 | |
|
| 62 | |
public void failedOutcomes(String step, OutcomesTable table) { |
| 63 | 1 | failure = new StepFailed(step, table); |
| 64 | 1 | delegate.failedOutcomes(step, table); |
| 65 | 1 | } |
| 66 | |
|
| 67 | |
public void ignorable(String step) { |
| 68 | 1 | delegate.ignorable(step); |
| 69 | 1 | } |
| 70 | |
|
| 71 | |
public void notPerformed(String step) { |
| 72 | 1 | delegate.notPerformed(step); |
| 73 | 1 | } |
| 74 | |
|
| 75 | |
public void pending(String step) { |
| 76 | 1 | delegate.pending(step); |
| 77 | 1 | } |
| 78 | |
|
| 79 | |
public void successful(String step) { |
| 80 | 1 | delegate.successful(step); |
| 81 | 1 | } |
| 82 | |
|
| 83 | |
public void givenStories(GivenStories givenStories) { |
| 84 | 1 | delegate.givenStories(givenStories); |
| 85 | 1 | } |
| 86 | |
|
| 87 | |
public void givenStories(List<String> storyPaths) { |
| 88 | 0 | delegate.givenStories(storyPaths); |
| 89 | 0 | } |
| 90 | |
|
| 91 | |
public void beforeExamples(List<String> steps, ExamplesTable table) { |
| 92 | 1 | delegate.beforeExamples(steps, table); |
| 93 | 1 | } |
| 94 | |
|
| 95 | |
public void example(Map<String, String> tableRow) { |
| 96 | 1 | delegate.example(tableRow); |
| 97 | 1 | } |
| 98 | |
|
| 99 | |
public void afterExamples() { |
| 100 | 1 | delegate.afterExamples(); |
| 101 | 1 | } |
| 102 | |
|
| 103 | |
public void scenarioNotAllowed(Scenario scenario, String filter) { |
| 104 | 0 | delegate.scenarioNotAllowed(scenario, filter); |
| 105 | 0 | } |
| 106 | |
|
| 107 | |
public void storyNotAllowed(Story story, String filter) { |
| 108 | 0 | delegate.storyNotAllowed(story, filter); |
| 109 | 0 | } |
| 110 | |
|
| 111 | |
public void dryRun() { |
| 112 | 1 | delegate.dryRun(); |
| 113 | 1 | } |
| 114 | |
|
| 115 | |
public void pendingMethods(List<String> methods) { |
| 116 | 0 | delegate.pendingMethods(methods); |
| 117 | 0 | } |
| 118 | |
|
| 119 | |
} |