Coverage Report - org.jbehave.core.model.Story
 
Classes in this File Line Coverage Branch Coverage Complexity
Story
100%
20/20
100%
4/4
1.182
 
 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 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(List<Scenario> scenarios) {
 24  11
         this(Description.EMPTY, Narrative.EMPTY, scenarios);
 25  11
     }
 26  
 
 27  
     public Story(Description description, Narrative narrative, List<Scenario> scenarios) {
 28  16
         this(null, description, narrative, scenarios);
 29  16
     }
 30  
 
 31  43
     public Story(String path, Description description, Narrative narrative, List<Scenario> scenarios) {
 32  43
         this.path = path;
 33  43
         this.description = description;
 34  43
         this.narrative = narrative;
 35  43
         this.scenarios = scenarios;
 36  43
     }
 37  
 
 38  
     public Description getDescription() {
 39  15
         return description;
 40  
     }
 41  
 
 42  
     public Narrative getNarrative() {
 43  29
         return narrative;
 44  
     }
 45  
 
 46  
     public List<Scenario> getScenarios() {
 47  36
         return unmodifiableList(scenarios);
 48  
     }
 49  
 
 50  
     public String getName() {
 51  2
         return (name != null ? name : getPath());
 52  
     }
 53  
 
 54  
     public void namedAs(String name) {
 55  12
         this.name = name;
 56  12
     }
 57  
 
 58  
     public String getPath() {
 59  28
         return (path != null ? path : "");
 60  
     }
 61  
 
 62  
     @Override
 63  
     public String toString() {
 64  5
         return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
 65  
     }
 66  
 
 67  
 }