The implementation of this specification should be fairly easy. All we need to do is set the constructor argument to the location variable:
public class Ship { private final Location location;
public Ship(Location location) {
this.location = location; }
public Location getLocation() {
return location;
}
}
The full source can be found in the req01-location branch of the tdd-java-ch04-ship repository (https://bitbucket.org/vfarcic/tdd-java-ch04-ship/branch/req01-location).