KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > junit > testresults > test > TestClassTest


1 /*
2  * TestClassTest.java
3  * JUnit based test
4  *
5  * Created on September 12, 2006, 12:05 PM
6  */

7
8 package org.netbeans.test.junit.testresults.test;
9
10 import junit.framework.*;
11
12 /**
13  *
14  * @author ms159439
15  */

16 public class TestClassTest extends TestCase {
17     
18     public TestClassTest(String JavaDoc testName) {
19         super(testName);
20     }
21
22     protected void setUp() throws Exception JavaDoc {
23     }
24
25     protected void tearDown() throws Exception JavaDoc {
26     }
27     
28     public static Test suite() {
29         junit.framework.TestSuite suite =
30                 new junit.framework.TestSuite(TestClassTest.class);
31         return suite;
32     }
33
34     /**
35      * Test of add0 method, of class org.netbeans.test.junit.testresults.test.TestClass.
36      */

37     public void testAdd0() {
38         System.out.println("add0");
39         
40         int a = 1;
41         int b = 1;
42         TestClass instance = new TestClass();
43         
44         int expResult = 2;
45         int result = instance.add0(a, b);
46         assertEquals(expResult, result);
47     }
48
49     /**
50      * Test of add1 method, of class org.netbeans.test.junit.testresults.test.TestClass.
51      */

52     public void testAdd1() {
53         System.out.println("add1");
54         
55         int a = 1;
56         int b = 1;
57         TestClass instance = new TestClass();
58         
59         int expResult = 0; //wrong -- should fail
60
int result = instance.add1(a, b);
61         assertEquals(expResult, result);
62     }
63     
64 }
65
Popular Tags