KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > pmti > v1 > itf > ITestRecordUTestI


1 /*
2  * @(#)ITestRecordUTestI.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.pmti.v1.itf;
28
29 import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
30 import org.easymock.EasyMock;
31 import org.easymock.MockControl;
32 import net.sourceforge.groboutils.junit.v1.iftc.*;
33 import junit.framework.Test;
34 import junit.framework.TestCase;
35 import junit.framework.TestSuite;
36
37
38 /**
39  * Tests the ITestRecord interface.
40  *
41  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
42  * @since July 14, 2002
43  * @version $Date: 2003/02/10 22:52:06 $
44  */

45 public class ITestRecordUTestI extends InterfaceTestCase
46 {
47     //-------------------------------------------------------------------------
48
// Standard JUnit Class-specific declarations
49

50     private static final Class JavaDoc THIS_CLASS = ITestRecordUTestI.class;
51     private static final AutoDoc DOC = new AutoDoc( THIS_CLASS );
52     
53     public ITestRecordUTestI( String JavaDoc name, ImplFactory f )
54     {
55         super( name, ITestRecord.class, f );
56     }
57
58     
59     public ITestRecord createITestRecord()
60     {
61         return (ITestRecord)createImplObject();
62     }
63
64
65     //-------------------------------------------------------------------------
66
// Tests
67

68     
69     public void testGetTestName1()
70     {
71         ITestRecord tr = createITestRecord();
72         String JavaDoc name = tr.getTestName();
73     }
74     
75     
76     public void testGetTestSuite1()
77     {
78         ITestRecord tr = createITestRecord();
79         String JavaDoc name = tr.getTestSuite();
80     }
81     
82     
83     public void testGetLog1()
84     {
85         ITestRecord tr = createITestRecord();
86         String JavaDoc log = tr.getLog();
87     }
88     
89     
90     public void testGetTestCount1()
91     {
92         ITestRecord tr = createITestRecord();
93         int count = tr.getTestCount();
94         assertTrue(
95             "Not valid count "+count+".",
96             count >= 0 );
97     }
98     
99     
100     public void testGetRuntime1()
101     {
102         ITestRecord tr = createITestRecord();
103         long time = tr.getRuntime();
104         assertTrue(
105             "Not valid runtime "+time+".",
106             time >= 0L );
107     }
108     
109     
110     public void testGetFailures1()
111     {
112         ITestRecord tr = createITestRecord();
113         String JavaDoc f[] = tr.getFailures();
114         assertNotNull(
115             "Returned null failure list.",
116             f );
117         for (int i = 0; i < f.length; ++i)
118         {
119             assertNotNull(
120                 "Returned null failure at index "+i+".",
121                 f[i] );
122             assertTrue(
123                 "Returned empty failure string at index "+i+".",
124                 f[i].length() > 0 );
125         }
126     }
127     
128     
129     public void testGetErrors1()
130     {
131         ITestRecord tr = createITestRecord();
132         String JavaDoc e[] = tr.getErrors();
133         assertNotNull(
134             "Returned null failure list.",
135             e );
136         for (int i = 0; i < e.length; ++i)
137         {
138             assertNotNull(
139                 "Returned null failure at index "+i+".",
140                 e[i] );
141             assertTrue(
142                 "Returned empty failure string at index "+i+".",
143                 e[i].length() > 0 );
144         }
145     }
146     
147     
148     public void testCombo1()
149     {
150         ITestRecord tr = createITestRecord();
151         int count = tr.getTestCount();
152         String JavaDoc e[] = tr.getErrors();
153         String JavaDoc f[] = tr.getFailures();
154         
155         assertTrue(
156             "Test Count ("+count+
157             ") is less than the number of errors ("+e.length+
158             ") and failures ("+f.length+").",
159             count >= e.length + f.length );
160     }
161     
162     
163     //-------------------------------------------------------------------------
164
// Standard JUnit declarations
165

166     
167     public static InterfaceTestSuite suite()
168     {
169         InterfaceTestSuite suite = new InterfaceTestSuite( THIS_CLASS );
170         
171         return suite;
172     }
173     
174     public static void main( String JavaDoc[] args )
175     {
176         String JavaDoc[] name = { THIS_CLASS.getName() };
177         
178         // junit.textui.TestRunner.main( name );
179
// junit.swingui.TestRunner.main( name );
180

181         junit.textui.TestRunner.main( name );
182     }
183     
184     
185     /**
186      *
187      * @exception Exception thrown under any exceptional condition.
188      */

189     protected void setUp() throws Exception JavaDoc
190     {
191         super.setUp();
192         
193         // set ourself up
194
}
195     
196     
197     /**
198      *
199      * @exception Exception thrown under any exceptional condition.
200      */

201     protected void tearDown() throws Exception JavaDoc
202     {
203         // tear ourself down
204

205         
206         super.tearDown();
207     }
208 }
209
210
Popular Tags