KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > HelloWorldUTest


1
2 import junit.framework.Test;
3 import junit.framework.TestCase;
4 import junit.framework.TestSuite;
5
6
7 /**
8  * Simple tests for the HelloWorld class.
9  *
10  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
11  * @version $Date: 2003/11/22 07:13:15 $
12  * @since November 15, 2003
13  */

14 public class HelloWorldUTest extends TestCase
15 {
16     private static final Class JavaDoc THIS_CLASS = HelloWorldUTest.class;
17     
18     public HelloWorldUTest( String JavaDoc name )
19     {
20         super( name );
21     }
22
23
24     //-------------------------------------------------------------------------
25
// Tests
26

27     public void testGetText()
28     {
29         HelloWorld hw = new HelloWorld();
30         String JavaDoc t = hw.getText();
31         assertEquals( "did not return correct text.",
32             "Hello, world!",
33             t );
34     }
35     
36     
37     public void testExecute()
38     {
39         HelloWorld hw = new HelloWorld();
40         hw.execute();
41     }
42     
43     
44     //-------------------------------------------------------------------------
45
// Standard JUnit declarations
46

47     
48     public static Test suite()
49     {
50         TestSuite suite = new TestSuite( THIS_CLASS );
51         
52         return suite;
53     }
54 }
55
56
Popular Tags