Highlights
Objectives
• Practice developing effective unit tests
• Practice implementing unit tests with JUnit
Background
You have inherited some buggy code for computing shortest path solutions to the board game Ticket to Ride. 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.
Given a game board of rail segments and a list of routes (pairs of cities), the code is supposed to compute the total cost of building a network between the given routes, assuming that the shortest distance for each route is chosen. This can be computed by computing shortest paths for each route using Dijkstra’s shortest path algorithm.
You will be provided with a partial codebase for distance computation, 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.
Note that the code you are provided does not have a main method and does not have the method implementing Dijkstra’s shortest path algorithm. These will be provided in a later assignment. You only need to write unit tests, not code for the Ticket to Ride problem in this assignment.
Task
1. Read the specification of what the code is supposed to do in docs/specification.pdf
2. Create a set of unit tests using JUnit5 for the following classes:
• City.java
• Link.java
• CityComparator.java
3. Use a separate test class for each of the above target classes. Some sample empty tests and real 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. An example is provided.
6. Commit and push back to the remote repository. As the primary branch is called “main” you will need to use the command “git push origin main”. Remember to check that all your files have been submitted using the web interface to git.
This CSCI 2134 - IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment Experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.