KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > pmti > v1 > autodoc > v1 > ITFJUnitListenerJDK13UTest


1 /*
2  * @(#)ITFJUnitListenerJDK13UTest.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.autodoc.v1;
28
29 import net.sourceforge.groboutils.autodoc.v1.testserver.junit.*;
30 import org.easymock.EasyMock;
31 import org.easymock.MockControl;
32 import junit.framework.Test;
33 import junit.framework.TestCase;
34 import junit.framework.TestSuite;
35 import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
36 import net.sourceforge.groboutils.autodoc.v1.junit.AutoDocJUnitListenerUTestI;
37 import net.sourceforge.groboutils.autodoc.v1.testserver.TestData;
38 import net.sourceforge.groboutils.junit.v1.iftc.*;
39 import junit.framework.AssertionFailedError;
40
41
42 /**
43  * Tests the ITFJUnitListener class.
44  *
45  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
46  * @version $Date: 2003/05/29 13:04:45 $
47  * @since March 5, 2002
48  */

49 public class ITFJUnitListenerJDK13UTest extends TestCase
50 {
51     //-------------------------------------------------------------------------
52
// Standard JUnit Class-specific declarations
53

54     private static final Class JavaDoc THIS_CLASS = ITFJUnitListenerJDK13UTest.class;
55     private static final AutoDoc DOC = new AutoDoc( THIS_CLASS );
56     
57     public ITFJUnitListenerJDK13UTest( String JavaDoc name )
58     {
59         super( name );
60     }
61
62     
63     //-------------------------------------------------------------------------
64
// setup
65

66     private MockControl testControl;
67     private Test mockTest;
68     
69     
70     /**
71      *
72      * @exception Exception thrown under any exceptional condition.
73      */

74     protected void setUp() throws Exception JavaDoc
75     {
76         super.setUp();
77         
78         // set ourself up
79
this.testControl = EasyMock.controlFor( Test.class );
80         this.mockTest = (Test)this.testControl.getMock();
81     }
82
83
84     //-------------------------------------------------------------------------
85
// Tests
86

87
88     public void testAddFailure1()
89     {
90         DOC.getIT().testsIssue( 526454 );
91         
92         createListener().addFailure( (TestData)null, null );
93     }
94     
95
96     public void testAddFailure1a()
97     {
98         DOC.getIT().testsIssue( 526454 );
99         
100         createListener().addFailure( (Test)null, null );
101     }
102     
103     
104     public void testAddFailure2()
105     {
106         DOC.getIT().testsIssue( 526454 );
107         
108         createListener().addFailure( (TestData)null,
109             new AssertionFailedError( "ignore error") );
110     }
111     
112     
113     public void testAddFailure2a()
114     {
115         DOC.getIT().testsIssue( 526454 );
116         
117         createListener().addFailure( (Test)null,
118             new AssertionFailedError( "ignore error") );
119     }
120     
121     
122     public void testAddFailure3()
123     {
124         this.testControl.activate();
125         
126         createListener().addFailure( this.mockTest,
127             new AssertionFailedError( "ignore error") );
128         
129         this.testControl.verify();
130     }
131     
132     
133     public void testAddError1()
134     {
135         DOC.getIT().testsIssue( 526454 );
136         
137         createListener().addError( (TestData)null, null );
138     }
139     
140     
141     public void testAddError1a()
142     {
143         DOC.getIT().testsIssue( 526454 );
144         
145         createListener().addError( (Test)null, null );
146     }
147     
148     
149     public void testAddError2()
150     {
151         DOC.getIT().testsIssue( 526454 );
152         
153         createListener().addError( (TestData)null, new Throwable JavaDoc(
154             "ignore error") );
155     }
156     
157     
158     public void testAddError2a()
159     {
160         DOC.getIT().testsIssue( 526454 );
161         
162         createListener().addError( (Test)null, new Throwable JavaDoc(
163             "ignore error") );
164     }
165     
166     
167     public void testAddError3()
168     {
169         this.testControl.activate();
170         
171         createListener().addError( this.mockTest,
172             new Throwable JavaDoc( "ignore error") );
173         
174         this.testControl.verify();
175     }
176     
177     
178     
179     
180     //-------------------------------------------------------------------------
181
// Helpers
182

183     protected ITFJUnitListener createListener()
184     {
185         return new ITFJUnitListener();
186     }
187     
188     
189     //-------------------------------------------------------------------------
190
// Standard JUnit declarations
191

192     
193     public static Test suite()
194     {
195         InterfaceTestSuite suite = JUnitTestListenerUTestI.suite();
196         suite.addTestSuite( THIS_CLASS );
197         suite.addFactory( new CxFactory( "A" ) {
198             public Object JavaDoc createImplObject() {
199                 return new ITFJUnitListener();
200             }
201         } );
202         
203         return suite;
204     }
205     
206     public static void main( String JavaDoc[] args )
207     {
208         String JavaDoc[] name = { THIS_CLASS.getName() };
209         
210         // junit.textui.TestRunner.main( name );
211
// junit.swingui.TestRunner.main( name );
212

213         junit.textui.TestRunner.main( name );
214     }
215     
216     
217     /**
218      *
219      * @exception Exception thrown under any exceptional condition.
220      */

221     protected void tearDown() throws Exception JavaDoc
222     {
223         // tear ourself down
224

225         
226         super.tearDown();
227     }
228 }
229
230
Popular Tags