1 /********************************************************************************
2 * DDTUnit, a Datadriven Approach to Unit- and Moduletesting
3 * Copyright (c) 2004, Joerg and Kai Gellien
4 * All rights reserved.
5 *
6 * The Software is provided under the terms of the Common Public License 1.0
7 * as provided with the distribution of DDTUnit in the file cpl-v10.html.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * + Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * + Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 *
20 * + Neither the name of the authors or DDTUnit, nor the
21 * names of its contributors may be used to endorse or promote
22 * products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 ********************************************************************************/
37 package junitx.ddtunit.resources;
38
39 import java.util.List;
40 import java.util.Vector;
41
42 import junit.framework.AssertionFailedError;
43 import junit.framework.Test;
44 import junitx.ddtunit.DDTTestListener;
45 import junitx.ddtunit.IDDTTestCase;
46
47 /**
48 * TestRunner implemantation for evaluation of DDTTestResult functionality.
49 *
50 * @author jg
51 */
52 public class RunnerMonitor implements DDTTestListener
53 {
54 private static RunnerMonitor singleton;
55 private List errors;
56 private List failures;
57 private StringBuffer buffer;
58
59 /**
60 * Private Constructor for instanciation singleton.
61 */
62 private RunnerMonitor()
63 {
64 this.errors = new Vector();
65 this.failures = new Vector();
66 this.buffer = new StringBuffer();
67 }
68
69 /**
70 * Create singleton instance of TestRunner
71 * @return instance of TestRunner
72 */
73 public static RunnerMonitor getInstance()
74 {
75 if (singleton == null)
76 {
77 singleton = new RunnerMonitor();
78 }
79
80 return singleton;
81 }
82
83 /**
84 * TODO Comment for overridden method
85 *
86 * @see junitx.ddtunit.DDTTestListener#addMethodTestError(junit.framework.Test,
87 * java.lang.String, java.lang.Throwable)
88 */
89 public void addMethodTestError(Test test, String testName,
90 Throwable throwable)
91 {
92 // TODO Auto-generated method stub
93 }
94
95 /**
96 * TODO Comment for overridden method
97 *
98 * @see junitx.ddtunit.DDTTestListener#addMethodTestFailure(junit.framework.Test,
99 * java.lang.String, junit.framework.AssertionFailedError)
100 */
101 public void addMethodTestFailure(Test test, String testName,
102 AssertionFailedError assertFailed)
103 {
104 // TODO Auto-generated method stub
105 }
106
107 /**
108 * TODO Comment for overridden method
109 *
110 * @see junitx.ddtunit.DDTTestListener#endMethodTest(junitx.ddtunit.DDTTestCase,
111 * java.lang.String)
112 */
113 public void endMethodTest(IDDTTestCase test, String testName)
114 {
115 // TODO Auto-generated method stub
116 }
117
118 /**
119 * TODO Comment for overridden method
120 *
121 * @see junitx.ddtunit.DDTTestListener#startMethodTest(junitx.ddtunit.DDTTestCase,
122 * java.lang.String)
123 */
124 public void startMethodTest(IDDTTestCase test, String testName)
125 {
126 // TODO Auto-generated method stub
127 }
128
129 /**
130 * TODO Comment for overridden method
131 *
132 * @see junit.framework.TestListener#addError(junit.framework.Test,
133 * java.lang.Throwable)
134 */
135 public void addError(Test test, Throwable t)
136 {
137 // TODO Auto-generated method stub
138 }
139
140 /**
141 * TODO Comment for overridden method
142 *
143 * @see junit.framework.TestListener#addFailure(junit.framework.Test,
144 * junit.framework.AssertionFailedError)
145 */
146 public void addFailure(Test test, AssertionFailedError t)
147 {
148 // TODO Auto-generated method stub
149 }
150
151 /**
152 * TODO Comment for overridden method
153 *
154 * @see junit.framework.TestListener#endTest(junit.framework.Test)
155 */
156 public void endTest(Test test)
157 {
158 // TODO Auto-generated method stub
159 }
160
161 /**
162 * TODO Comment for overridden method
163 *
164 * @see junit.framework.TestListener#startTest(junit.framework.Test)
165 */
166 public void startTest(Test test)
167 {
168 // TODO Auto-generated method stub
169 }
170
171 /**
172 * @return Returns the errors.
173 */
174 public List getErrors()
175 {
176 return this.errors;
177 }
178
179 /**
180 * @return Returns the failures.
181 */
182 public List getFailures()
183 {
184 return this.failures;
185 }
186
187 /**
188 * @return Returns the buffer.
189 */
190 public StringBuffer getBuffer()
191 {
192 return this.buffer;
193 }
194
195 /**
196 */
197 public void resetBuffer()
198 {
199 this.buffer.replace(0, this.buffer.length(), "");
200 }
201 }