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