1 /* 2 * The MIT License 3 * 4 * Copyright (c) <2010> <tap4j> 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 * THE SOFTWARE. 23 */ 24 package org.tap4j.model; 25 26 /** 27 * TAP Plan. The TAP Plan gives details about the execution of the tests such as 28 * initial test number, last test number, flag to skip all tests and a reason 29 * for this. 30 * 31 * @since 1.0 32 */ 33 public class Plan extends AbstractTapElementDiagnostic { 34 35 /* 36 * Serial Version UID. 37 */ 38 private static final long serialVersionUID = 8517740981464132024L; 39 40 /** 41 * Default initial test step. 42 */ 43 private static final Integer INITIAL_TEST_STEP = 1; 44 45 /** 46 * TAP Plan initial test number. 47 */ 48 private Integer initialTestNumber; 49 50 /** 51 * TAP Plan last test number. 52 */ 53 private Integer lastTestNumber; 54 55 /** 56 * TAP Plan skip. If present the tests should not be executed. 57 */ 58 private SkipPlan skip; 59 60 /** 61 * A comment. 62 */ 63 private Comment comment; 64 65 /** 66 * Constructor with parameters. 67 * 68 * @param initialTestNumber Initial test number (usually is 1). 69 * @param lastTestNumber Last test number (may be 0 if to skip all tests). 70 */ 71 public Plan(Integer initialTestNumber, Integer lastTestNumber) { 72 super(); 73 this.initialTestNumber = initialTestNumber; 74 this.lastTestNumber = lastTestNumber; 75 } 76 77 /** 78 * Constructor with parameters. 79 * 80 * @param amountOfTests How many tests we have in the plan. 81 */ 82 public Plan(Integer amountOfTests) { 83 super(); 84 this.initialTestNumber = INITIAL_TEST_STEP; 85 this.lastTestNumber = amountOfTests; 86 } 87 88 /** 89 * Constructor with parameters 90 * 91 * @param amountOfTests How many tests we have in the plan. 92 * @param skip Plan skip with a reason. 93 */ 94 public Plan(Integer amountOfTests, SkipPlan skip) { 95 super(); 96 this.initialTestNumber = INITIAL_TEST_STEP; 97 this.lastTestNumber = amountOfTests; 98 this.skip = skip; 99 } 100 101 /** 102 * Constructor with parameters 103 * 104 * @param initialTestNumber Initial test number (usually is 1). 105 * @param lastTestNumber Last test number (may be 0 if to skip all tests). 106 * @param skip Plan skip with a reason. 107 */ 108 public Plan(Integer initialTestNumber, Integer lastTestNumber, SkipPlan skip) { 109 super(); 110 this.initialTestNumber = initialTestNumber; 111 this.lastTestNumber = lastTestNumber; 112 this.skip = skip; 113 } 114 115 /** 116 * @return Initial test number. 117 */ 118 public Integer getInitialTestNumber() { 119 return this.initialTestNumber; 120 } 121 122 /** 123 * @return Last test number. 124 */ 125 public Integer getLastTestNumber() { 126 return this.lastTestNumber; 127 } 128 129 /** 130 * @return Flag used to indicate whether skip all tests or not. 131 */ 132 public Boolean isSkip() { 133 return this.skip != null; 134 } 135 136 /** 137 * @return Plan Skip with reason. 138 */ 139 public SkipPlan getSkip() { 140 return this.skip; 141 } 142 143 /** 144 * Defines whether we should skip all tests or not. 145 * 146 * @param skip Plan Skip. 147 */ 148 public void setSkip(SkipPlan skip) { 149 this.skip = skip; 150 } 151 152 /** 153 * @return Optional Plan comment. 154 */ 155 public Comment getComment() { 156 return this.comment; 157 } 158 159 /** 160 * Sets a comment into the Plan. 161 * 162 * @param comment Plan comment. 163 */ 164 public void setComment(Comment comment) { 165 this.comment = comment; 166 } 167 168 }