1- For this project, you will start with the code that is provided.
2- You will use JUnit to test each and all of the methods in the two classes provided (you do not have to test the getHash methods)
3- Here are two links to tutorials about JUnit:
a. [url removed, login to view]
b. [url removed, login to view]
4- You will write methods in the two test classes to test each method in the corresponding class.
5- You should test each method at least once
6- For the equals method, you should write at least the following tests:
a. Where the two objects are the same object
b. Where the object passed in is null
c. Where the object passed in is not of the same type as the class it is in
d. Where the two objects are different objects but have the same data
7- There is at least one method that has errors. During your testing you should locate that and make the changes to the method then retest.
8- Include a text file in your folder with the class/method that had errors followed by a description of the error(s). Also state what you did to fix the errors.
9- Then you will write an exception class to handle the error of the denominator in the Fraction2 class being equal to 0.
10- Any method that can set the denominator must then throw the exception and not set the denominator to 0.
New material learned for this project
1. Using JUnit to test
2. Debugging code
3. Writing your own exception class
4. The key word throw
The points will be earned as follows:
For this project, you must use JUnit to test the methods in the two classes provided. If you do not use JUnit to do this, you will earn 0 points on this project. Otherwise, the points are as many as 130 points and are assigned as follows:
1. You will write methods in the Fraction2Test class to test all of the methods (except getHash and main) – 50
2. You will write methods in the Rectangle class to test all of the methods (except getHash and main) – 45
3. You will debug the code and discover which method has error. You will create a text document and write which class/method has the errors, what the errors are and how you fix the errors. - 10
4. You will then fix the errors in the code and run the tests proving that the errors were fixed – 10
5. You will write an exception class to handle when the denominator is 0 – 5
6. You will use the exception class to handle any time the denominator is set to 0. - 10