##### Coverage Report - org.jbehave.core.model.Scenario

Classes in this File | Line Coverage | Branch Coverage | Complexity
Scenario |
100% | 26/26
N/A | N/A
| 1.0;1

1 |  |
     package org.jbehave.core.model;
2 |  |
3 |  |
     import static java.util.Collections.unmodifiableList;
4 |  |
5 |  |
     import java.util.Arrays;
6 |  |
     import java.util.List;
7 |  |
     import java.util.Properties;
8 |  |
9 |  |
     import org.apache.commons.lang.builder.ToStringBuilder;
10 |  |
     import org.apache.commons.lang.builder.ToStringStyle;
11 |  |
12 |  |
     public class Scenario {
13 |  |
14 |  |
         private final String title;
15 |  |
         private final Meta meta;
16 |  |
         private final GivenStories givenStories;
17 |  |
         private final ExamplesTable examplesTable;
18 |  |
         private final List<String> steps;
19 |  |
20 |  |
         public Scenario() {
21 | 16 |
             this(Arrays.<String>asList());
22 | 16 |
         }
23 |  |
24 |  |
         public Scenario(List<String> steps) {
25 | 24 |
             this("", steps);
26 | 24 |
         }
27 |  |
28 |  |
         public Scenario(String title, Meta meta) {
29 | 2 |
             this(title, meta, GivenStories.EMPTY, ExamplesTable.EMPTY, Arrays.<String>asList());
30 | 2 |
         }
31 |  |
32 |  |
         public Scenario(String title, List<String> steps) {
33 | 32 |
             this(title, Meta.EMPTY, GivenStories.EMPTY, ExamplesTable.EMPTY, steps);
34 | 32 |
         }
35 |  |
36 | 173 |
         public Scenario(String title, Meta meta, GivenStories givenStories, ExamplesTable examplesTable, List<String> steps) {
37 | 173 |
             this.title = title;
38 | 173 |
             this.meta = meta;
39 | 173 |
             this.givenStories = givenStories;
40 | 173 |
             this.examplesTable = examplesTable;
41 | 173 |
             this.steps = steps;
42 | 173 |
         }
43 |  |
44 |  |
         public String getTitle() {
45 | 43 |
             return title;
46 |  |
         }
47 |  |
48 |  |
         public GivenStories getGivenStories() {
49 | 37 |
             return givenStories;
50 |  |
         }
51 |  |
52 |  |
         public ExamplesTable getExamplesTable() {
53 | 31 |
             return examplesTable;
54 |  |
         }
55 |  |
56 |  |
         public Meta asMeta(String prefix){
57 | 33 |
             Properties p = new Properties();
58 | 33 |
             p.setProperty(prefix+"title", title);
59 | 33 |
             p.setProperty(prefix+"givenStories", givenStories.asString());
60 | 33 |
             p.setProperty(prefix+"examplesTable", examplesTable.asString());
61 | 33 |
             return new Meta(p);
62 |  |
         }
63 |  |
64 |  |
         public Meta getMeta(){
65 | 89 |
             return meta;
66 |  |
         }
67 |  |
68 |  |
         public List<String> getSteps() {
69 | 127 |
             return unmodifiableList(steps);
70 |  |
         }
71 |  |
72 |  |
         @Override
73 |  |
         public String toString() {
74 | 15 |
             return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
75 |  |
         }
76 |  |
77 |  |
     }