@Test
  public void should_ignore_commands_until_first_place_command() throws IOException {
    when(commander.getNextCommand())
        .thenReturn("")
        .thenReturn("MOVE")
        .thenReturn("MOVE")
        .thenReturn("LEFT")
        .thenReturn("MOVE")
        .thenReturn(null);
    robotSimulator.run();

    assertThat(robot.getX(), equalTo(0));
    assertThat(robot.getY(), equalTo(0));
    assertThat(robot.getFacingDirection(), nullValue());
    assertFalse(robot.isOnBoard());
  }
예제 #2
0
 @Test
 public void given_valid_coordinate__THEN__should_set_robot_status_to_be_onBoard() {
   assertFalse(robot.isOnBoard());
   new PlaceCommand(1, 1, Direction.WEST).execute(robot);
   assertTrue(robot.isOnBoard());
 }