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 Sample3 abstract class.
24: * <P>
25: * Formatted for 70-column publication.
26: *
27: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
28: * @since July 21, 2002
29: * @version $Date: 2002/07/28 22:43:58 $
30: */
31: public class Sample3IUTestI extends InterfaceTestCase {
32: private static final Class THIS_CLASS = Sample3IUTestI.class;
33:
34: public Sample3IUTestI(String name, ImplFactory f) {
35: super (name, Sample1.class, f);
36: }
37:
38: protected Sample3 createSample3() {
39: return (Sample3) createImplObject();
40: }
41:
42: //---------------------------------------------------------------
43: // Tests
44:
45: public void testGetAddedStrings1() {
46: Sample3 s3 = createSample3();
47: s3.addString( "a" );
48: java.util.Enumeration enum = s3.getAddedStrings();
49: assertNotNull( "Returned null.", enum );
50: assertTrue( "Has no added strings.", enum.hasMoreElements() );
51: assertEquals( "Not right string.", "a", enum.nextElement() );
52: assertTrue( "Has too many added strings.",
53: !enum.hasMoreElements() );
54: }
55:
56: public static InterfaceTestSuite suite() {
57: InterfaceTestSuite suite = Sample1IUTestI.suite();
58: suite.addTestSuite(THIS_CLASS);
59:
60: return suite;
61: }
62: }
|