March 2018
Intermediate to advanced
324 pages
8h 30m
English
The first thing we can do is pass the Planet object with the maximum X and Y axis coordinates to the Ship constructor. Fortunately, Planet is one more of the helper classes that have already been made (and tested). All we need to do is instantiate it and pass it to the Ship constructor:
public void whenInstantiatedThenPlanetIsStored() {
Point max = new Point(50, 50);
Planet planet = new Planet(max);
ship = new Ship(location, planet);
assertEquals(ship.getPlanet(), planet);
}
We're defining the size of the planet as 50 x 50 and passing that to the Planet class. In turn, that class is afterwards passed to the Ship constructor. You might have noticed that the constructor needs an extra argument. In the current ...
Read now
Unlock full access