Coverage Report - org.jbehave.core.model.Story
 
Classes in this File Line Coverage Branch Coverage Complexity
Story
100%
26/26
100%
4/4
1.143
 
 1  
 package org.jbehave.core.model;
 2  
 
 3  
 import java.util.Arrays;
 4  
 import java.util.List;
 5  
 import org.apache.commons.lang.builder.ToStringBuilder;
 6  
 import org.apache.commons.lang.builder.ToStringStyle;
 7  
 
 8  
 import static java.util.Collections.unmodifiableList;
 9  
 
 10  
 public class Story {
 11  
 
 12  
     private final String path;
 13  
     private final Description description;
 14  
     private final Meta meta;
 15  
     private final Narrative narrative;
 16  
     private final List<Scenario> scenarios;
 17  
     private String name;
 18  
 
 19  
     public Story() {
 20  6
         this(Arrays.<Scenario>asList());
 21  6
     }
 22  
 
 23  
     public Story(String path) {
 24  11
         this(path, Description.EMPTY, Narrative.EMPTY, Arrays.<Scenario>asList());
 25  11
     }
 26  
 
 27  
     public Story(List<Scenario> scenarios) {
 28  15
         this(Description.EMPTY, Narrative.EMPTY, scenarios);
 29  15
     }
 30  
 
 31  
     public Story(Description description, Narrative narrative, List<Scenario> scenarios) {
 32  22
         this((String)null, description, narrative, scenarios);
 33  22
     }
 34  
 
 35  
     public Story(String path, Description description, Narrative narrative, List<Scenario> scenarios) {
 36  35
         this(path, description, Meta.EMPTY, narrative, scenarios);
 37  35
     }
 38  
 
 39  79
     public Story(String path, Description description, Meta meta, Narrative narrative, List<Scenario> scenarios) {
 40  79
         this.path = path;
 41  79
         this.description = description;
 42  79
         this.meta = meta;
 43  79
         this.narrative = narrative;
 44  79
         this.scenarios = scenarios;
 45  79
     }
 46  
 
 47  
     public Description getDescription() {
 48  22
         return description;
 49  
     }
 50  
 
 51  
     public Meta getMeta() {
 52  87
         return meta;
 53  
     }
 54  
 
 55  
     public Narrative getNarrative() {
 56  41
         return narrative;
 57  
     }
 58  
 
 59  
     public List<Scenario> getScenarios() {
 60  65
         return unmodifiableList(scenarios);
 61  
     }
 62  
 
 63  
     public String getName() {
 64  12
         return (name != null ? name : getPath());
 65  
     }
 66  
 
 67  
     public void namedAs(String name) {
 68  33
         this.name = name;
 69  33
     }
 70  
 
 71  
     public String getPath() {
 72  138
         return (path != null ? path : "");
 73  
     }
 74  
 
 75  
     @Override
 76  
     public String toString() {
 77  5
         return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
 78  
     }
 79  
 
 80  
 
 81  
 }