35
Testing with jUnit
●jUnit is a Java-based unit testing tool
●Available at www.junit.org
●Tests should match package of tested class
●Extend junit.framework.TestCase
public class BaseDAOTest extends TestCase {
...
public void testAddObject() {
Customer customer = new Customer();
customer.setName("Fred Flintstone");
customer.setEmail("
[email protected]");
BaseDao bDAO = new BaseDao();
try {
bDAO.add(customer);
} catch (Throwable t) {
fail("Unable to add new Customer " + customer);
}
}