01: /*
02: * @(#)Sample1IUTestI.java
03: *
04: * Original author is Matt Albrecht
05: * groboclown@users.sourceforge.net
06: * http://groboutils.sourceforge.net
07: *
08: * This code sample has been submitted to the public domain, to show
09: * 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: * Tests the Sample1 interface. These tests are in no way exhaustive, but
24: * only shown for example.
25: * <P>
26: * Formatted for 70-column publication.
27: *
28: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
29: * @since March 1, 2002
30: * @version $Date: 2002/07/28 22:43:58 $
31: */
32: public class Sample1IUTestI extends InterfaceTestCase {
33: private static final Class THIS_CLASS = Sample1IUTestI.class;
34:
35: public Sample1IUTestI(String name, ImplFactory f) {
36: super (name, Sample1.class, f);
37: }
38:
39: protected Sample1 createSample1() {
40: return (Sample1) createImplObject();
41: }
42:
43: //---------------------------------------------------------------
44: // Tests
45:
46: public void testAddString1() {
47: Sample1 s1 = createSample1();
48: try {
49: s1.addString(null);
50: fail("Did not throw IllegalArgumentException.");
51: } catch (IllegalArgumentException e) {
52: // successfully threw an IllegalArgumentException
53: }
54: }
55:
56: public static InterfaceTestSuite suite() {
57: InterfaceTestSuite suite = new InterfaceTestSuite(THIS_CLASS);
58: return suite;
59: }
60: }
|