Implementation

By now, you should be getting used to focusing on one unit at a time and to trust that those that were done before are working as expected. This implementation should be no different. We just need to make sure that the maximum coordinates are used when the location.forward method is called:

public boolean moveForward() {
  // return location.forward();
  return location.forward(planet.getMax());
}

The same specification and implementation should be done for the backward method. For brevity, it is excluded from this book, but it can be found in the source code.

The full source for this requirement can be found in the req05-wrap branch of the tdd-java-ch04-ship repository (https://bitbucket.org/vfarcic/tdd-java-ch04-ship/branch/req05-wrap).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.230.81