Exemplo n.º 1
0
  @Test
  public void testGetListLawnMowerWithLongInstruction() throws Exception {

    List<Paire<List<Instruction>, LawnMower>> listLawnMowerWithInstruction =
        parser.getListLawnMowerWithInstruction();

    assertThat(listLawnMowerWithInstruction).hasSize(2);
    assertThat(listLawnMowerWithInstruction.get(0).getLeftElement())
        .containsSequence(
            Instruction.G,
            Instruction.A,
            Instruction.G,
            Instruction.A,
            Instruction.G,
            Instruction.A,
            Instruction.G,
            Instruction.A,
            Instruction.A);
    assertThat(listLawnMowerWithInstruction.get(1).getLeftElement())
        .containsSequence(
            Instruction.A,
            Instruction.A,
            Instruction.D,
            Instruction.A,
            Instruction.A,
            Instruction.D,
            Instruction.A,
            Instruction.D,
            Instruction.D,
            Instruction.A);
  }
Exemplo n.º 2
0
  @Test
  public void testGetListLawnMowerWithShortInstruction() throws Exception {

    inputDataList = Lists.newArrayList("5 5", "1 1 N", "A");
    parser = new MowItNowParser(inputDataList);

    List<Paire<List<Instruction>, LawnMower>> listLawnMowerWithInstruction =
        parser.getListLawnMowerWithInstruction();

    assertThat(listLawnMowerWithInstruction).hasSize(1);
    assertThat(listLawnMowerWithInstruction.get(0).getLeftElement())
        .containsSequence(Instruction.A);
  }
Exemplo n.º 3
0
  @Test
  public void testGetArea() throws Exception {

    assertThat(parser.getArea()).isEqualsToByComparingFields(new Area(5, 5));
  }