could anyone pls tell me how to perform a juint test in a right way and simple
why do i get test failed :mad: when i perform a junit test to the following java program
public class Adder
{
public static int add (int firstNum, int secondNum)
{
return firstNum + secondNum;
}
}
as the test class is as follows
public class AdderTest {

public AdderTest() {
}

@BeforeClass
public static void setUpClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
}

/**
* Test of add method, of class Adder.
*/
@Test
public void testAdd() {
System.out.println("add");
int firstNum = 0;
int secondNum = 0;
int expResult = 0;
int result = Adder.add(firstNum, secondNum);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
assertEquals(0, Adder.add(0, 0));
assertEquals(5, Adder.add(2, 3));
assertEquals(4, Adder.add(5, -1));
assertEquals(-4, Adder.add(-5, 1));
assertEquals(-10, Adder.add(-7, -3));
assertEquals(1, Adder.add(2, -1));
assertEquals(13, Adder.add(7, 6));
fail("The test case is a prototype.");
}
}
thanks for any help!