KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > junit > v1 > iftc > Sample1IUTestI


1 /*
2  * @(#)Sample1IUTestI.java
3  *
4  * Original author is Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * This code sample has been submitted to the public domain, to show
9  * uses for the Interface testing framework.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  */

15
16 package net.sourceforge.groboutils.junit.v1.iftc;
17
18 import junit.framework.Test;
19 import junit.framework.TestCase;
20 import junit.framework.TestSuite;
21
22
23 /**
24  * Tests the Sample1 interface. These tests are in no way exhaustive, but
25  * only shown for example.
26  * <P>
27  * Formatted for 70-column publication.
28  *
29  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
30  * @since March 1, 2002
31  * @version $Date: 2002/07/28 22:43:58 $
32  */

33 public class Sample1IUTestI extends InterfaceTestCase
34 {
35     private static final Class JavaDoc THIS_CLASS = Sample1IUTestI.class;
36     
37     public Sample1IUTestI( String JavaDoc name, ImplFactory f ) {
38         super( name, Sample1.class, f );
39     }
40
41     protected Sample1 createSample1() {
42         return (Sample1)createImplObject();
43     }
44
45     //---------------------------------------------------------------
46
// Tests
47

48     public void testAddString1() {
49         Sample1 s1 = createSample1();
50         try {
51             s1.addString( null );
52             fail( "Did not throw IllegalArgumentException." );
53         } catch (IllegalArgumentException JavaDoc e) {
54             // successfully threw an IllegalArgumentException
55
}
56     }
57     
58     public static InterfaceTestSuite suite() {
59         InterfaceTestSuite suite =
60             new InterfaceTestSuite( THIS_CLASS );
61         return suite;
62     }
63 }
64
65
Popular Tags