To understand how to write unit tests, let's take the JDBC version of the Course Management application that we developed in Chapter 4, Creating JEE Database Applications. Let's start with a simple test case for validating a course. The following is the source code of Course.java
:
package packt.book.jee.eclipse.ch5.bean; import java.sql.SQLException; import java.util.List; import packt.book.jee.eclipse.ch5.dao.CourseDAO; public class Course { private int id; private String name; private int credits; private Teacher teacher; private int teacherId; private CourseDAO courseDAO = new CourseDAO(); public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getCredits() { return credits; } public void setCredits(int credits) { this...