KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > util > throwable > v1 > ChainableExceptionUTest


1 /*
2  * @(#)ChainableExceptionUTest.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.util.throwable.v1;
28
29 import java.io.PrintStream JavaDoc;
30 import java.io.PrintWriter JavaDoc;
31 import java.io.StringWriter JavaDoc;
32 import java.io.ByteArrayOutputStream JavaDoc;
33 import net.sourceforge.groboutils.autodoc.v1.*;
34 import net.sourceforge.groboutils.junit.v1.iftc.*;
35 import junit.framework.Test;
36 import junit.framework.TestCase;
37 import junit.framework.TestSuite;
38
39
40 /**
41  * Tests the ChainableException class.
42  *
43  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
44  * @version $Date: 2003/05/06 05:35:02 $
45  * @since March 17, 2002
46  */

47 public class ChainableExceptionUTest extends TestCase
48 {
49     //-------------------------------------------------------------------------
50
// Standard JUnit Class-specific declarations
51

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

66     /**
67      *
68      * @exception Exception thrown under any exceptional condition.
69      */

70     protected void setUp() throws Exception JavaDoc
71     {
72         super.setUp();
73         
74         // set ourself up
75
}
76
77
78     //-------------------------------------------------------------------------
79
// Tests
80

81     public void testAllTestsCoveredByInterfaceTests()
82     {
83         // do nothing
84
}
85     
86     
87     //-------------------------------------------------------------------------
88
// Helpers
89

90     
91     //-------------------------------------------------------------------------
92
// Standard JUnit declarations
93

94     
95     public static class CEFactory
96         implements IChainableExceptionUTestI.IChainableExceptionFactory
97     {
98         public IChainableException createException()
99         {
100             return new ChainableException();
101         }
102         
103         public IChainableException createException( String JavaDoc message )
104         {
105             return new ChainableException( message );
106         }
107         
108         public IChainableException createException( Throwable JavaDoc cause )
109         {
110             return new ChainableException( cause );
111         }
112         
113         public IChainableException createException( String JavaDoc message,
114             Throwable JavaDoc cause )
115         {
116             return new ChainableException( message, cause );
117         }
118         
119         public IChainableException createException( Throwable JavaDoc cause,
120             String JavaDoc message )
121         {
122             return new ChainableException( cause, message );
123         }
124     }
125         
126     
127     
128     public static Test suite()
129     {
130         InterfaceTestSuite suite = IChainableExceptionUTestI.suite();
131         
132         // all tests are covered by the interface tests, so don't need this
133
// line. But will add it for insurance in case tests are needed later.
134
suite.addTestSuite( THIS_CLASS );
135         
136         DOC.getLog().info( "Adding factory to suite." );
137         suite.addFactory( new CxFactory( "A" ) {
138             public Object JavaDoc createImplObject() {
139                 DOC.getLog().info( "Creating factory implementation object." );
140                 return new CEFactory();
141                 //return null;
142
}
143         } );
144         
145         DOC.getLog().info( "Returning suite." );
146         return suite;
147     }
148     
149     public static void main( String JavaDoc[] args )
150     {
151         String JavaDoc[] name = { THIS_CLASS.getName() };
152         
153         // junit.textui.TestRunner.main( name );
154
// junit.swingui.TestRunner.main( name );
155

156         junit.textui.TestRunner.main( name );
157     }
158     
159     
160     /**
161      *
162      * @exception Exception thrown under any exceptional condition.
163      */

164     protected void tearDown() throws Exception JavaDoc
165     {
166         // tear ourself down
167

168         
169         super.tearDown();
170     }
171 }
172
173
Popular Tags