Harvard University Partial Codebase for JSON Comparison Java Program Project
Question Description
Problem Statement
Create a set of unit tests using JUnit5 for provided classes to find some bugs and test the
correctness of the code.
Background
You have inherited some buggy code for comparing JSON objects. Your boss fired their previous
developer because the former developer did not do any testing. Your boss has hired you to
write a comprehensive set of tests for part of the codebase. For now, she just wants you to
create the test suite.
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 partial codebase for JSON comparison, a specification, a starter
JUnit5 test class, and a list of classes for which you are to create unit tests. Your job is to create
the test suite and identify the bugs. You will fix the bugs in a later assignment so do not spend
time fixing them now.
For this assignment, you will need to research the JSON format on the web. For example:
https://www.json.org. A brief summary is provided in the specification, but you are encouraged
to do more in-depth research. Task
1. Observe the main method in JSim.java . Note that you can also create a JSONScanner from a
string which will be helpful for creating good unit tests.
2. Create a set of unit tests using JUnit5 for the following classes:
• ArrayValue.java
• ObjectValue.java
• Pair.java
• PrimitiveValue.java
• Value.java
3. Use a separate test class for each of the above target classes. Some sample empty tests
have been provided. For each test class
a. You can decide if you want to use white-box testing, black-box testing, or grey-box
testing.
b. Create as many tests for each method of each class as needed. Recall from class
that we discussed ways of determining how many tests we would need. By
analysing the code (white-box testing) or the specification (black-box testing).
c. Each test should provide an appropriate message if it fails.
d. Use good formatting and documentation in your tests, just like for any source code.
4. All the test classes should compile and be runnable in IntelliJ. If your test classes do not
compile, you will receive 0 on the assignment.
5. Record all detected errors in a file called errors.txt in the docs directory. You do not
need to debug, just record the method and class that failed. Each error should have the
following information:
a. Class name
b. Method name
c. Test name that caught the error
d. Message that the test method generated
This information will be used to assess the number of errors found by your tests.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."