Re: How should I write Junit test cases?
Posted By:
shameer_antony
Posted On:
Monday, July 2, 2007 05:22 AM
Write a class with name Test at the end extend TestCase.
Write methods which start with Test, and call your method from it and write assert* methods from your test method
for eg: you want to write test case for class ABC
class ABCTest extends TestCase {
public setup(){
//Anything which need to call before each of your methods.
}
public tearDown(){
//Anything which need to call after each of your methods.
}
public class testMyMethod(){
ABC abc = new ABC();
Object a = abc.mymethod();
assertNotNull("Expecting a not null object here, but not",a);
}
reply back
}