CPE 103 Lab Activity

JUnit Practice

This lab will help you become skilled at writing automated unit tests using the JUnit framework.

Prerequisites:
Why JUnit?
Unit Testing in BlueJ pg1-11.
JUnit and BlueJ video


Read the short section "For novice testers" in the JUnit Style guide.
A popular introductory Java textbook provides an Account.java class that represents a bank account.
Create a new BlueJ project and add the Account class source code.
Create a JUnit test class, AccountTest, and write test cases which exercise all the methods of the Account class.  
Compile your classes and and run the JUnit tests.  Correct any defects in your tests.
If your tests reveal any defects in the logic of the Account class, repair them.
Write a new test case that reveals a more subtle defect lurking in the Account class.  (Hint: Bad Money example). You don't have to repair this defect.

Submit your Account class and JUnit tests as described in the syllabus.