O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementation

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).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required