Question: Write test class with at least two unit tests that test different cases for the closer() function described below: Either write a 3rd distinct test

Write test class with at least two unit tests that test different cases for the closer() function described below:

Either write a 3rd distinct test case for closer() or explain why 2 cases is enough

class Loc { // (latitude, longitude) - coordinates for location on a map public Loc(float lat, float lon);

}

class Nav {

// Destination

public void setDest(Loc goal);

// return negative value if loc1 is closer to destination than loc2

// positive value if loc2 is closer

// zero if they are equally close to the destination

public int closer(Loc loc1, Loc loc2);

}

class TestNav { // Your test code goes here

Step by Step Solution

3.42 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a simple unit test class for the closer function in the Nav class import orgjunitTest import ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!