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

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.