Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This test is a junit test. My thought is position A, since we're not supposed to fail the test right? If put in position A,
This test is a junit test. My thought is position A, since we're not supposed to fail the test right? If put in position A, fail() would not be reached because an exception is thrown before reaching it, and the junit test passes. This is what we want, right?
Otherwise, if the answer is position B (or something else), please specify and explain why. Thank you so much!!!
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 alderaanLocationUtil.getCoordinate("Alderaan") // trying to jump to light speed should throw an exception try ds.jumpToLightSpeed(alderaan); /I Position A fail); catch (HyperDri veOfflineException e) System.err.println(e) /1 Position B fail) ) finally -t I Position C fail) Choose the best place(s) to add the 'fail)' statement: (1 point)
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