Exemplo n.º 1
0
  @Test
  public void testMove() throws Exception {
    Position init = new Position(1, 2);
    Rover rover = new Rover("test", init, Direction.N);

    SUT.move(rover, Instruction.L);
    assertEquals(init, rover.getPosition());
    assertEquals(Direction.W, rover.getDirection());

    Position expected = new Position(0, 2);
    SUT.move(rover, Instruction.M);
    assertEquals(expected, rover.getPosition());
    assertEquals(Direction.W, rover.getDirection());

    SUT.move(rover, Instruction.R);
    assertEquals(expected, rover.getPosition());
    assertEquals(Direction.N, rover.getDirection());
  }
Exemplo n.º 2
0
 @Test(expected = Exception.class)
 public void testMoveThrowsExceptionWhenPositionOutOfBound() throws Exception {
   Position init = new Position(0, 2);
   Rover rover = new Rover("test", init, Direction.W);
   SUT.move(rover, Instruction.M);
 }