import com.thoughtworks.rover.MarsRover;
import com.thoughtworks.rover.navigation.Compass;
import com.thoughtworks.rover.navigation.Navigator;
import com.thoughtworks.rover.universe.Coordinates;
import com.thoughtworks.rover.universe.Plateau;
import org.junit.Assert;
import org.junit.Test;

public class MarsRoverTest {

    @Test
    public void TestThatRoverCanRotateRight() {
        //Given
        Plateau plateau = new Plateau(5,5);
        Coordinates initialRoverCoordinates = new Coordinates(1,2);
        Navigator roverNavigator = new Navigator(new Compass().pointingToNorth(), initialRoverCoordinates, plateau);
        MarsRover marsRover = new MarsRover(roverNavigator);

        //When
        marsRover.handleCommand("R");

        //then
        Assert.assertEquals("1 2 E", marsRover.currentLocation());
    }

    @Test
    public void TestThatRoverCanRotateLeft() {
        //Given
        Plateau plateau = new Plateau(5,5);
        Coordinates initialRoverCoordinates = new Coordinates(1,2);
        Navigator roverNavigator = new Navigator(new Compass().pointingToSouth(), initialRoverCoordinates, plateau);
        MarsRover marsRover = new MarsRover(roverNavigator);

        //When
        marsRover.handleCommand("L");

        //then
        Assert.assertEquals("1 2 E", marsRover.currentLocation());
    }

    @Test
    public void TestThatRoverCanMove() {
        //Given
        Plateau plateau = new Plateau(5,5);
        Coordinates initialRoverCoordinates = new Coordinates(1,2);
        Navigator roverNavigator = new Navigator(new Compass().pointingToNorth(), initialRoverCoordinates, plateau);
        MarsRover marsRover = new MarsRover(roverNavigator);

        //When
        marsRover.handleCommand("M");

        //then
        Assert.assertEquals("1 3 N", marsRover.currentLocation());
    }

    @Test
    public void TestThatRoverCanProcessAStringOfCommands() {
        //Given
        Plateau plateau = new Plateau(5,5);
        Coordinates initialRoverCoordinates = new Coordinates(3,3);
        Navigator roverNavigator = new Navigator(new Compass().pointingToEast(), initialRoverCoordinates, plateau);
        MarsRover marsRover = new MarsRover(roverNavigator);

        //When
        marsRover.handleCommand("MMRMMRMRRM");

        //then
        Assert.assertEquals("5 1 E", marsRover.currentLocation());
    }

    @Test
    public void TestThatRoverIgnoredTheCommandToDriveOffPlateau() {
        //Given
        Plateau plateau = new Plateau(5,5);
        Coordinates initialRoverCoordinates = new Coordinates(3,3);
        Navigator roverNavigator = new Navigator(new Compass().pointingToNorth(), initialRoverCoordinates, plateau);
        MarsRover marsRover = new MarsRover(roverNavigator);

        //When
        marsRover.handleCommand("MMMMMMMMMMR");

        //then
        Assert.assertEquals("3 5 E", marsRover.currentLocation());
    }

}

@@ -445,389 +445,1495 @@
     
-Coordinates initialRoverCoordinates = new Coordinates(1,2);%0A        Navigator roverNavigator = new Navigator(new Compass().pointingToNorth(), initialRoverCoordinates, plateau);%0A        MarsRover marsRover = new MarsRover(roverNavigator);%0A%0A        //When%0A        marsRover.handleCommand(%22R%22);%0A%0A        //then%0A        Assert.assertEquals(%221 2 E%22, marsRover.currentLocation());%0A    %7D%0A
+//Chirag: initialPosition or startingPosition maybe a slightly better name because it %0A        //matches with the domain language in the problem statement%0A        Coordinates initialRoverCoordinates = new Coordinates(1,2);%0A        // Chirag: new Compass().pointingToNorth() can be replaced with a static Creator method %0A        // Compass.pointingNorth()%0A        Navigator roverNavigator = new Navigator(new Compass().pointingToNorth(), initialRoverCoordinates, plateau);%0A        MarsRover marsRover = new MarsRover(roverNavigator);%0A%0A        //When%0A        marsRover.handleCommand(%22R%22); %0A        //Chirag: handleCommand() is a bit verbose and unnatural as a name. %0A        // Think about if you were talking to a rover, what would you say.%0A        // do(), run(), execute() those are some alternatives. I suspect Java wont allow do or run :()%0A%0A        //then%0A        Assert.assertEquals(%221 2 E%22, marsRover.currentLocation());%0A    %7D%0A%0A    /*%0A    Chirag: I prefer to create test cases with the same starting position and starting direction (pointingNorth)%0A    and then based on R or L movement the resulting pointing direction should be opposite.%0A    With the current first two tests, its possible that there is a bug in the code that alwys resutls in pointing East%0A    regardless of the starting direction%0A    %0A    The test name can be a bit shorter CanRotateLeft(), CanMove() since we are already in MarsRoverTest. %0A    Junit doesn't force you to start with Test....() now right ?%0A    **/
 %0A   

Update MarsRoverTest.java