Question
1. Congratulations, you have been offered an internship position by the Galactic Empire! You will be working with the Death Star team as a testing
1. Congratulations, you have been offered an internship position by the
Galactic Empire! You will be working with the Death Star team as a testing
engineer, making sure that the Empire's proudest piece of machinery is fully
operational so that the Emperor does not become the laughingstock of those
Rebel Scums.
Knowing that the `DeathStar` class has 2 constructors and 1136 public
methods, in general, how many units are there to be tested? (1 point)
2. One of the methods you are testing is for the Death Star to make hologram
calls. The method will take in a contact number as parameter, and returns
the `ConnectionStream` object if the call is connected and `null` if the
call never was picked up.
Complete the following test: (1 point)
```
public void testMakeHologramCall() {
// construct a new Death Star
DeathStar ds = new DeathStar();
// call Darth Vader
String contact = "327-848-2337";
// this method should return null since Darth Vader never picks up calls
ConnectionStream stream = ds.makeHologramCall(contact);
// make assertion and fill in the blank (in the *BRACKETS* below)
_____________________________
}
3. Another method, `jumpToLightSpeed`, takes in a coordinate as parameter for
the destination, and throws a `HyperDriveOfflineException` if hyperdrive
appears to be offline.
```
public void testJumpToLightSpeed(Coordinate destination) {
// construct a new Death Star
DeathStar ds = new DeathStar();
// turn off hyperdrive
ds.hyperDrive.off();
// destination: Planet Alderaan
Coordinate alderaan = LocationUtil.getCoordinate("Alderaan");
// trying to jump to light speed should throw an exception
try {
ds.jumpToLightSpeed(alderaan);
// Position A
fail();
} catch (HyperDriveOfflineException e) {
System.err.println(e);
// Position B
fail();
} finally {
// Position C
fail();
}
}
```
Choose the best place(s) to add the `fail()` statement: (1 point)
4. After writing these test cases, you would like to simplify the building
process of these tests. You would like to be able to recompile
`DeathStarTester.java` simply by typing `make` into the command line.
What is the default target inside a Makefile? (1 point)
5. Assuming that you want the Makefile to recompile the test only if
`DeathStar.java` or `DeathStarTester.java` have been updated since the last
time it was compiled, what goes to the depency list below? (1 point)
DeathStarTester.class: _________________ # answer in the *BRACKETS* below
javac DeathStarTester.java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started