Posted By:
juanita_J
Posted On:
Monday, November 6, 2006 04:56 AM
I wrote a very simple example of junit. I have a Math class public class Math { static public int add(int a, int b) { return a + b; } static public int multiply ( int a, int b) { return a * b; } } and TestMath class import junit.framework.*; public class TestMath extends TestCase { protected void setUp() { } protected void tearDown() { } public void testAdd() { int num1 = 3; int num2 = 2; int total = 5; int sum = 0; sum = Math.add(num1, num2); assertEquals(sum, total);
More>>
I wrote a very simple example of junit.
I have a Math class
public class Math {
static public int add(int a, int b) {
return a + b;
}
static public int multiply ( int a, int b) {
return a * b;
}
}
and TestMath class
import junit.framework.*;
public class TestMath extends TestCase {
protected void setUp() {
}
protected void tearDown() {
}
public void testAdd() {
int num1 = 3;
int num2 = 2;
int total = 5;
int sum = 0;
sum = Math.add(num1, num2);
assertEquals(sum, total);
}
}
I have the junit.jar in the ant home.When I am trying to
compile my classes I get the following error:
(TestCase(java.lang.String) in junit.framework.TestCase
cannot be applied to ()
Any help?
<<Less