##### Coverage Report - org.jbehave.core.parsers.TransformingStoryParser

Classes in this File | Line Coverage | Branch Coverage | Complexity
TransformingStoryParser |
90% | 9/10
100% | 2/2
| 1.25;1.25

1 |  |
     package org.jbehave.core.parsers;
2 |  |
3 |  |
     import org.jbehave.core.model.Story;
4 |  |
5 |  |
     public class TransformingStoryParser implements StoryParser {
6 |  |
7 |  |
             private final StoryParser delegate;
8 |  |
             private StoryTransformer[] transformers;
9 |  |
10 | 1 |
             public TransformingStoryParser(StoryParser delegate, StoryTransformer... transformers) {
11 | 1 |
                     this.delegate = delegate;
12 | 1 |
                     this.transformers = transformers;
13 | 1 |
             }
14 |  |
15 |  |
             public Story parseStory(String storyAsText) {
16 | 1 |
                     return delegate.parseStory(transform(storyAsText));
17 |  |
             }
18 |  |
19 |  |
             public Story parseStory(String storyAsText, String storyPath) {
20 | 0 |
                     return delegate.parseStory(transform(storyAsText), storyPath);
21 |  |
             }
22 |  |
23 |  |
             private String transform(String storyAsText) {
24 | 1 |
                     String transformed = storyAsText;
25 | 2 |
                     for ( StoryTransformer transformer : transformers ){
26 | 1 |
                             transformed = transformer.transform(transformed);
27 |  |
                     }
28 | 1 |
                     return transformed;
29 |  |
             }
30 |  |
31 |  |
     }