31 lines
842 B
Java
31 lines
842 B
Java
package cat.hack3.codingtests.marsrover;
|
|
|
|
import org.testng.annotations.BeforeMethod;
|
|
import org.testng.annotations.Test;
|
|
|
|
import static cat.hack3.codingtests.marsrover.MarsMap.Direction.SOUTH;
|
|
import static org.testng.Assert.assertEquals;
|
|
|
|
public class MarsRoverTest {
|
|
|
|
private MarsMap marsMap;
|
|
private MarsRover rover;
|
|
|
|
@BeforeMethod
|
|
public void setUp() {
|
|
int mapWidth = 10;
|
|
int mapHeight = 10;
|
|
marsMap = new MarsMap(mapWidth, mapHeight);
|
|
|
|
int latitudeStartingPoint = 2;
|
|
int longitudeStartingPoint = 3;
|
|
rover = new MarsRover(marsMap, latitudeStartingPoint, longitudeStartingPoint, SOUTH);
|
|
}
|
|
|
|
@Test
|
|
public void roverMakeItsFirstStep() {
|
|
Coordinates currentPosition = rover.moveForward();
|
|
assertEquals(currentPosition, Coordinates.of(3, 3));
|
|
}
|
|
}
|