KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > mbtf > v1 > IErrorsUTestI


1 /*
2  * @(#)IErrorsUTestI.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.mbtf.v1;
28
29 import org.easymock.EasyMock;
30 import org.easymock.MockControl;
31 import net.sourceforge.groboutils.junit.v1.iftc.*;
32 import junit.framework.Test;
33 import junit.framework.TestCase;
34 import junit.framework.TestSuite;
35
36
37 /**
38  * Tests the IErrors interface.
39  *
40  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
41  * @since March 27, 2002
42  * @version $Date: 2003/02/10 22:52:27 $
43  */

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

49     private static final Class JavaDoc THIS_CLASS = IErrorsUTestI.class;
50     
51     public IErrorsUTestI( String JavaDoc name, ImplFactory f )
52     {
53         super( name, IErrors.class, f );
54     }
55
56     
57     public IErrors createIErrors()
58     {
59         return (IErrors)createImplObject();
60     }
61
62
63     //-------------------------------------------------------------------------
64
// Tests
65

66     public void testHalt1()
67     {
68         IErrors e = createIErrors();
69         
70         try
71         {
72             e.halt( null );
73             fail( "Did not throw TestHaltRuntimeException." );
74         }
75         catch (TestHaltRuntimeException ex)
76         {
77         }
78         
79         assertNotNull(
80             "Returned null error list.",
81             e.getErrors() );
82         assertEquals(
83             "Returned incorrect number of errors.",
84             1,
85             e.getErrors().length );
86     }
87     
88     
89     public void testHalt2()
90     {
91         IErrors e = createIErrors();
92         
93         try
94         {
95             e.halt( "" );
96             fail( "Did not throw TestHaltRuntimeException." );
97         }
98         catch (TestHaltRuntimeException ex)
99         {
100         }
101         
102         assertNotNull(
103             "Returned null error list.",
104             e.getErrors() );
105         assertEquals(
106             "Returned incorrect number of errors.",
107             1,
108             e.getErrors().length );
109     }
110     
111     
112     public void testHalt3()
113     {
114         IErrors e = createIErrors();
115         
116         try
117         {
118             e.halt( "a" );
119             fail( "Did not throw TestHaltRuntimeException." );
120         }
121         catch (TestHaltRuntimeException ex)
122         {
123         }
124         
125         assertNotNull(
126             "Returned null error list.",
127             e.getErrors() );
128         assertEquals(
129             "Returned incorrect number of errors.",
130             1,
131             e.getErrors().length );
132     }
133     
134     
135     public void testFail1()
136     {
137         IErrors e = createIErrors();
138         
139         try
140         {
141             e.fail( null );
142             fail( "Did not throw TestFailRuntimeException." );
143         }
144         catch (TestFailRuntimeException ex)
145         {
146         }
147         
148         assertNotNull(
149             "Returned null error list.",
150             e.getErrors() );
151         assertEquals(
152             "Returned incorrect number of errors.",
153             1,
154             e.getErrors().length );
155     }
156     
157     
158     public void testFail2()
159     {
160         IErrors e = createIErrors();
161         
162         try
163         {
164             e.fail( "" );
165             fail( "Did not throw TestFailRuntimeException." );
166         }
167         catch (TestFailRuntimeException ex)
168         {
169         }
170         
171         assertNotNull(
172             "Returned null error list.",
173             e.getErrors() );
174         assertEquals(
175             "Returned incorrect number of errors.",
176             1,
177             e.getErrors().length );
178     }
179     
180     
181     public void testFail3()
182     {
183         IErrors e = createIErrors();
184         
185         try
186         {
187             e.fail( "a" );
188             fail( "Did not throw TestFailRuntimeException." );
189         }
190         catch (TestFailRuntimeException ex)
191         {
192         }
193         
194         assertNotNull(
195             "Returned null error list.",
196             e.getErrors() );
197         assertEquals(
198             "Returned incorrect number of errors.",
199             1,
200             e.getErrors().length );
201     }
202     
203     
204     public void testFail4()
205     {
206         IErrors e = createIErrors();
207         
208         try
209         {
210             e.fail( null, null );
211             fail( "Did not throw TestFailRuntimeException." );
212         }
213         catch (TestFailRuntimeException ex)
214         {
215         }
216         
217         assertNotNull(
218             "Returned null error list.",
219             e.getErrors() );
220         assertEquals(
221             "Returned incorrect number of errors.",
222             1,
223             e.getErrors().length );
224     }
225     
226     
227     public void testFail5()
228     {
229         IErrors e = createIErrors();
230         
231         try
232         {
233             e.fail( "", null );
234             fail( "Did not throw TestFailRuntimeException." );
235         }
236         catch (TestFailRuntimeException ex)
237         {
238         }
239         
240         assertNotNull(
241             "Returned null error list.",
242             e.getErrors() );
243         assertEquals(
244             "Returned incorrect number of errors.",
245             1,
246             e.getErrors().length );
247     }
248     
249     
250     public void testFail6()
251     {
252         IErrors e = createIErrors();
253         
254         try
255         {
256             e.fail( "a", null );
257             fail( "Did not throw TestFailRuntimeException." );
258         }
259         catch (TestFailRuntimeException ex)
260         {
261         }
262         
263         assertNotNull(
264             "Returned null error list.",
265             e.getErrors() );
266         assertEquals(
267             "Returned incorrect number of errors.",
268             1,
269             e.getErrors().length );
270     }
271     
272     
273     public void testFail7()
274     {
275         IErrors e = createIErrors();
276         
277         try
278         {
279             e.fail( null, new Throwable JavaDoc() );
280             fail( "Did not throw TestFailRuntimeException." );
281         }
282         catch (TestFailRuntimeException ex)
283         {
284         }
285         
286         assertNotNull(
287             "Returned null error list.",
288             e.getErrors() );
289         assertEquals(
290             "Returned incorrect number of errors.",
291             1,
292             e.getErrors().length );
293     }
294     
295     
296     public void testFail8()
297     {
298         IErrors e = createIErrors();
299         
300         try
301         {
302             e.fail( "", new Throwable JavaDoc() );
303             fail( "Did not throw TestFailRuntimeException." );
304         }
305         catch (TestFailRuntimeException ex)
306         {
307         }
308         
309         assertNotNull(
310             "Returned null error list.",
311             e.getErrors() );
312         assertEquals(
313             "Returned incorrect number of errors.",
314             1,
315             e.getErrors().length );
316     }
317     
318     
319     public void testFail9()
320     {
321         IErrors e = createIErrors();
322         
323         try
324         {
325             e.fail( "a", new Throwable JavaDoc() );
326             fail( "Did not throw TestFailRuntimeException." );
327         }
328         catch (TestFailRuntimeException ex)
329         {
330         }
331         
332         assertNotNull(
333             "Returned null error list.",
334             e.getErrors() );
335         assertEquals(
336             "Returned incorrect number of errors.",
337             1,
338             e.getErrors().length );
339     }
340     
341     
342     public void tstAddFailure1()
343     {
344         IErrors e = createIErrors();
345         e.addFailure( null );
346         
347         assertNotNull(
348             "Returned null error list.",
349             e.getErrors() );
350         assertEquals(
351             "Returned incorrect number of errors.",
352             1,
353             e.getErrors().length );
354     }
355     
356     
357     public void tstAddFailure2()
358     {
359         IErrors e = createIErrors();
360         e.addFailure( "" );
361         
362         assertNotNull(
363             "Returned null error list.",
364             e.getErrors() );
365         assertEquals(
366             "Returned incorrect number of errors.",
367             1,
368             e.getErrors().length );
369     }
370     
371     
372     public void tstAddFailure3()
373     {
374         IErrors e = createIErrors();
375         e.addFailure( "a" );
376         
377         assertNotNull(
378             "Returned null error list.",
379             e.getErrors() );
380         assertEquals(
381             "Returned incorrect number of errors.",
382             1,
383             e.getErrors().length );
384     }
385     
386     
387     public void tstAddFailure4()
388     {
389         IErrors e = createIErrors();
390         e.addFailure( null, null );
391         
392         assertNotNull(
393             "Returned null error list.",
394             e.getErrors() );
395         assertEquals(
396             "Returned incorrect number of errors.",
397             1,
398             e.getErrors().length );
399     }
400     
401     
402     public void tstAddFailure5()
403     {
404         IErrors e = createIErrors();
405         e.addFailure( "", null );
406         
407         assertNotNull(
408             "Returned null error list.",
409             e.getErrors() );
410         assertEquals(
411             "Returned incorrect number of errors.",
412             1,
413             e.getErrors().length );
414     }
415     
416     
417     public void tstAddFailure6()
418     {
419         IErrors e = createIErrors();
420         e.addFailure( "a", null );
421         
422         assertNotNull(
423             "Returned null error list.",
424             e.getErrors() );
425         assertEquals(
426             "Returned incorrect number of errors.",
427             1,
428             e.getErrors().length );
429     }
430     
431     
432     public void tstAddFailure7()
433     {
434         IErrors e = createIErrors();
435         e.addFailure( null, new Throwable JavaDoc() );
436         
437         assertNotNull(
438             "Returned null error list.",
439             e.getErrors() );
440         assertEquals(
441             "Returned incorrect number of errors.",
442             1,
443             e.getErrors().length );
444     }
445     
446     
447     public void tstAddFailure8()
448     {
449         IErrors e = createIErrors();
450         e.addFailure( "", new Throwable JavaDoc() );
451         
452         assertNotNull(
453             "Returned null error list.",
454             e.getErrors() );
455         assertEquals(
456             "Returned incorrect number of errors.",
457             1,
458             e.getErrors().length );
459     }
460     
461     
462     public void tstAddFailure9()
463     {
464         IErrors e = createIErrors();
465         e.addFailure( "a", new Throwable JavaDoc() );
466         
467         assertNotNull(
468             "Returned null error list.",
469             e.getErrors() );
470         assertEquals(
471             "Returned incorrect number of errors.",
472             1,
473             e.getErrors().length );
474     }
475     
476     
477     
478     
479     //-------------------------------------------------------------------------
480
// Standard JUnit declarations
481

482     
483     public static InterfaceTestSuite suite()
484     {
485         InterfaceTestSuite suite = new InterfaceTestSuite( THIS_CLASS );
486         
487         return suite;
488     }
489     
490     public static void main( String JavaDoc[] args )
491     {
492         String JavaDoc[] name = { THIS_CLASS.getName() };
493         
494         // junit.textui.TestRunner.main( name );
495
// junit.swingui.TestRunner.main( name );
496

497         junit.textui.TestRunner.main( name );
498     }
499     
500     
501     /**
502      *
503      * @exception Exception thrown under any exceptional condition.
504      */

505     protected void setUp() throws Exception JavaDoc
506     {
507         super.setUp();
508         
509         // set ourself up
510
}
511     
512     
513     /**
514      *
515      * @exception Exception thrown under any exceptional condition.
516      */

517     protected void tearDown() throws Exception JavaDoc
518     {
519         // tear ourself down
520

521         
522         super.tearDown();
523     }
524 }
525
526
Popular Tags