Creating and executing unit tests using Eclipse JEE

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() ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.