Coverage Report - org.jbehave.core.model.Scenario
 
Classes in this File Line Coverage Branch Coverage Complexity
Scenario
100%
26/26
N/A
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  169
     public Scenario(String title, Meta meta, GivenStories givenStories, ExamplesTable examplesTable, List<String> steps) {
 37  169
         this.title = title;
 38  169
         this.meta = meta;
 39  169
         this.givenStories = givenStories;
 40  169
         this.examplesTable = examplesTable;
 41  169
         this.steps = steps;
 42  169
     }
 43  
     
 44  
     public String getTitle() {
 45  41
         return title;
 46  
     }
 47  
 
 48  
     public GivenStories getGivenStories() {
 49  34
         return givenStories;
 50  
     }
 51  
 
 52  
     public ExamplesTable getExamplesTable() {
 53  28
         return examplesTable;
 54  
     }
 55  
 
 56  
     public Meta asMeta(String prefix){
 57  30
         Properties p = new Properties();
 58  30
         p.setProperty(prefix+"title", title);
 59  30
         p.setProperty(prefix+"givenStories", givenStories.asString());
 60  30
         p.setProperty(prefix+"examplesTable", examplesTable.asString());
 61  30
         return new Meta(p);
 62  
     }
 63  
 
 64  
     public Meta getMeta(){
 65  85
         return meta;
 66  
     }
 67  
 
 68  
     public List<String> getSteps() {
 69  124
         return unmodifiableList(steps);
 70  
     }
 71  
 
 72  
     @Override
 73  
     public String toString() {
 74  15
         return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
 75  
     }
 76  
 
 77  
 }