CS 3331 - Advanced Object-Oriented Programming HOMEWORK 4: UNIT TESTING (File $Date: 2009/10/07 17:15:53 $) Due: October 16, 2009 (Friday) The purpose of this homework is to learn how to test Java classes using JUnit. For this homework, download from the course website a sample handicap calculation program that calculates golf handicaps for amateur golf players (see the HW3 handout for requirements and the USGA handicap calculation formula). This sample program reads golf courses and scores (along with players' names) from text files named course.txt and score.txt, respectively; the formats of these files are similar to those of HW3. 1. (10 points) Draw a UML class diagram that depicts the structure of the downloaded program. Your diagram should show all the important relationships among the classes and interfaces. Include fields and methods only if they help in describing the design of the program. Omit the Main class and JUnit test classes from your class diagram. 2. (40 points) You will write JUnit tests for the downloaded program. The program also include sample JUnit tests. (a) Write a separate JUnit test class for each class included in the program except for the Main class. Your test class should include tests for each public method and constructor of the class under test. For class T, name your test class as TTest. (b) Combine all tests written in (a) above into a single JUnit test class named AllTestSuite. Your test programs will be graded mainly on the completeness and thoroughness of testing. For this, we may perform a "mutation testing" in which we mutate the source code under test to introduce a number of faults and see how many injected faults your tests can detect. TESTING Your tests should be written using Version 3 of JUnit (e.g., 3.8.1) not Version 4, and your code should compile and run correctly under Java 1.6.0 or later version. WHAT AND HOW TO TURN IN Submit your programs through the Assignment Submission page found in the Homework section of the course website. The page will ask you to zip, jar, or tar your programs, and upload a single file. The zip (jar or tar) file should include only a single directory named YourFirstNameLastName which contains all your source code files and other support files needed to compile and run your program. DO NOT INCLUDE BYTECODE (.class) FILES OR HTML FILES. You should turn in your programs before the class time on the due date. Note that the submission page will be automatically closed exactly on the sixth day from the due date. GRADING You will be graded, in part, on how clear your code is. Excessively long code will be penalized: don't repeat code in multiple places. You should document every class, interface, field, and method with Javadoc comments. Your code should be sensibly indented so it is easy to read. Be sure your name is in the comments in your code.