*Test Classes and TimexTestCaseMost of our earlier *Test classes looked something like the following code snippet from our original TimesheetManagerTest class: public class TimesheetManagerTest extends TestCase { TimesheetManager timesheetManager = new TimesheetManager(); public static void main(String args[]) Now, instead of extending the JUnit TestCase class directly, we extend the TimexTestCase class (in the timex2/ directory), as shown next: public class TimesheetManagerTest extends TimexTestCase { public static void main(String args[]) The benefit of this approach is that we can put all the fixture code in a parent class (such as TimexTestCase), so the test subclasses can focus on the unit tests versus fixture code (visit junit.org for details on fixture code). |