Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TestResult |
|
| 1.0;1 |
1 | /* | |
2 | * The MIT License | |
3 | * | |
4 | * Copyright (c) 2010 tap4j team (see AUTHORS) | |
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 | import java.util.LinkedList; | |
27 | import java.util.List; | |
28 | ||
29 | import org.tap4j.util.StatusValues; | |
30 | ||
31 | /** | |
32 | * A simple test result. Valid values are <em>OK</em> and <em>NOT OK</em>. | |
33 | * | |
34 | * @since 1.0 | |
35 | */ | |
36 | public class TestResult extends TapResult { | |
37 | ||
38 | /** | |
39 | * Serial Version UID. | |
40 | */ | |
41 | private static final long serialVersionUID = -2735372334488828166L; | |
42 | ||
43 | /** | |
44 | * Test Status (OK, NOT OK). | |
45 | */ | |
46 | private StatusValues status; | |
47 | ||
48 | /** | |
49 | * Test Number. | |
50 | */ | |
51 | private Integer testNumber; | |
52 | ||
53 | /** | |
54 | * Description of the test. | |
55 | */ | |
56 | private String description; | |
57 | ||
58 | /** | |
59 | * Directive of the test (TO DO, SKIP). | |
60 | */ | |
61 | private Directive directive; | |
62 | ||
63 | /** | |
64 | * Child subtest. | |
65 | */ | |
66 | private TestSet subtest; | |
67 | ||
68 | /** | |
69 | * Comment. | |
70 | */ | |
71 | private List<Comment> comments; | |
72 | ||
73 | /** | |
74 | * Default constructor. | |
75 | */ | |
76 | public TestResult() { | |
77 | 0 | super(); |
78 | 0 | this.status = StatusValues.NOT_OK; |
79 | 0 | this.testNumber = -1; |
80 | 0 | this.subtest = null; |
81 | 0 | this.comments = new LinkedList<Comment>(); |
82 | 0 | } |
83 | ||
84 | /** | |
85 | * Constructor with parameter. | |
86 | * | |
87 | * @param testStatus Status of the test. | |
88 | * @param testNumber Number of the test. | |
89 | */ | |
90 | public TestResult(StatusValues testStatus, Integer testNumber) { | |
91 | 0 | super(); |
92 | 0 | this.status = testStatus; |
93 | 0 | this.testNumber = testNumber; |
94 | 0 | this.comments = new LinkedList<Comment>(); |
95 | 0 | } |
96 | ||
97 | /** | |
98 | * @return Status of the test. | |
99 | */ | |
100 | public StatusValues getStatus() { | |
101 | 0 | return this.status; |
102 | } | |
103 | ||
104 | /** | |
105 | * @param status Status of the test. | |
106 | */ | |
107 | public void setStatus(StatusValues status) { | |
108 | 0 | this.status = status; |
109 | 0 | } |
110 | ||
111 | /** | |
112 | * @return Test Number. | |
113 | */ | |
114 | public Integer getTestNumber() { | |
115 | 0 | return this.testNumber; |
116 | } | |
117 | ||
118 | /** | |
119 | * @param testNumber Test Number. | |
120 | */ | |
121 | public void setTestNumber(Integer testNumber) { | |
122 | 0 | this.testNumber = testNumber; |
123 | 0 | } |
124 | ||
125 | /** | |
126 | * @return Test description. | |
127 | */ | |
128 | public String getDescription() { | |
129 | 0 | return this.description; |
130 | } | |
131 | ||
132 | /** | |
133 | * @param description Test description. | |
134 | */ | |
135 | public void setDescription(String description) { | |
136 | 0 | this.description = description; |
137 | 0 | } |
138 | ||
139 | /** | |
140 | * @return Optional Directive. | |
141 | */ | |
142 | public Directive getDirective() { | |
143 | 0 | return this.directive; |
144 | } | |
145 | ||
146 | /** | |
147 | * @param directive Optional Directive. | |
148 | */ | |
149 | public void setDirective(Directive directive) { | |
150 | 0 | this.directive = directive; |
151 | 0 | } |
152 | ||
153 | /** | |
154 | * @return the subtest | |
155 | */ | |
156 | public TestSet getSubtest() { | |
157 | 0 | return subtest; |
158 | } | |
159 | ||
160 | /** | |
161 | * @param subtest the subtest to set | |
162 | */ | |
163 | public void setSubtest(TestSet subtest) { | |
164 | 0 | this.subtest = subtest; |
165 | 0 | } |
166 | ||
167 | /** | |
168 | * @return The comments for this Test Result. | |
169 | */ | |
170 | public List<Comment> getComments() { | |
171 | 0 | return this.comments; |
172 | } | |
173 | ||
174 | /** | |
175 | * @param comments list of comments for this Test Result. | |
176 | */ | |
177 | public void setComments(List<Comment> comments) { | |
178 | 0 | this.comments = comments; |
179 | 0 | } |
180 | ||
181 | /** | |
182 | * Adds a new comment to this Test Result. | |
183 | * | |
184 | * @param comment comment for this Test Result. | |
185 | */ | |
186 | public void addComment(Comment comment) { | |
187 | 0 | this.comments.add(comment); |
188 | 0 | } |
189 | ||
190 | } |