Java代写|Assignment代写 - CSCI 2134 Assignment
Problem Statement Take a piece of buggy code, debug it, and fix it. Background You have inherited some buggy code for comparing JSON objects. Your boss has fired the previ￾ous developer because they did not do any testing and did not fix the bugs! She has hired you to debug and fix the code. She will provide you with some unit tests (some of which fail), sample input that exhibits bugginess, and sample output of what should be produced. Your job is to fix the bugs or explain why they can’t be easily fixed: Both the bugs exhibited by the unit tests and the ones by the input. Good luck! The code is supposed to determine if two JSON objects are the same. JSON, the (JavaScript Object Notation) is a widely-used encoding format that makes it easy to exchange data. JSON is a text￾based (human readable) format, which makes it ideal for many applications as well as easy to debug. You will be provided with a full buggy codebase for JSON comparison, a specification, a set of unit tests using JUnit5, sample input and expected output. Your job is to identify and fix all the bugs. For this assignment, you will need to research the JSON format on the web. For example: A brief summary is provided in the specification, but you are encouraged to do more in-depth research. Two example JSON files t1 (equal) and t2 (not equal) are included in the repository. Task 1. Review the specification (specification.pdf) in the docs directory. You will abso￾lutely need to understand it and the code you are debugging. The main method for the pro￾gram is in Spend some time tracing through the code and creating a diagram of how the classes and code is put together. This will help you a lot later on! 2. Fix all bugs that are identified by the tests generated by the unit tests in the following classes: • • • • • 3. Create a buglist.txt file in the docs directory. For each bug that you fix add an entry to this file that includes: a. The file/class name where the bug was. b. The method where the bug was c. The line number(s) where the buggy code was d. A description of what the bug was e. A description of what the fix was. 4. The specification states you can assume the input is correct JSON but this is not always the case. The previous developer made a set of example input and expected output in the sys￾tem_tests directory which have strange results. The code usually exits with an error or Exception when the input is not correct JSON but in some cases may instead report that a correct JSON object is equal to an incorrect JSON object. Track down the reason: • Compile and run JSim with each of the 8 input files,, … • Compare the output with the diff command to the expected output t1.expected, t2.ex￾pected, … t8.expected • For each output that differs from the expected output, debug the code and determine the reason for the mismatch. Fix any identified bugs missed by the unit tests. 5. Record the identified bugs causing the code to report a correct JSON object is equal to an incorrect JSON object in buglist.txt. Note: Do not try to make the code handle these cases. We will do so in Assignment 4. 6. Record any other bugs found and fixed from Step 4 in the previously created buglist.txt 7. Commit and push back the bug fixes and the buglist.txt file to the remote repository. Submission All fixes and files should be committed and pushed back to the remote Git repository. Grading The following grading scheme will be used: Task 4/4 3/4 2/4 1/4 0/4 Bugs found [unit tests] (10%) 4 to 5 bugs are correctly identi￾fied and docu￾mented. Three (3) bugs are correctly identified and documented. Two (2) bugs are correctly identified and documented. One (1) bug is cor￾rectly identified and documented. Zero (0) bugs are correctly identified and documented. Bugs fixed [unit tests] (20%) 4 to 5 bugs are correctly fixed. Three (3) bugs are correctly fixed. Two (2) bugs are correctly fixed. One (1) bug is cor￾rectly fixed. Zero (0) bugs are correctly fixed. Bugs found [input tests] (40%) 3 to 4 bugs are correctly Two (2) bugs are correctly One (1) bug is correctly Zero (0) bugs are correctly identified and documented. Zero (0) bugs are correctly identified and documented. identified and documented. identified and documented. identified and documented. Bugs fixed [input tests] (20%) At least one (1) new bug is correctly fixed. N/A N/A N/A Zero (0) bugs are correctly fixed. Document [buglist.txt] Clarity (10%) Document looks professional, includes all information, and easy to read Document looks ok. May be hard to read or missing some information. Document is sloppy, inconsistent, and has missing information Document is very sloppy with significant missing information Document is illegible or not provided. Hints 1. You will need to use a symbolic debugger to make headway. Using print-statements will be possible but extremely painful. 2. You will need to step through the code to find the bugs. 3. There are about 4 bugs in the code (in addition to the ones identified by the unit tests). The single bug report should cover all of them.