예제 #1
0
  /**
   * @param phase
   * @param currentPlayer
   * @param nrOfAmebasOffBoardBefore
   * @param nrOfAmebasOnBoardBefore
   * @param radioButton1IsEnabled
   * @param radioButton2IsEnabled
   * @param radioButton3IsEnabled
   * @param radioButton4IsEnabled
   * @param choseAmebaNr
   * @param xCoordinate
   * @param yCoordinate
   * @param damagePointsOfAmeba
   */
  public void setAmebaPhaseSetFirstAmebaCheck(
      PhaseSetFirstAmeba phase,
      Player currentPlayer,
      int nrOfAmebasOffBoardBefore,
      int nrOfAmebasOnBoardBefore,
      boolean radioButton1IsEnabled,
      boolean radioButton2IsEnabled,
      boolean radioButton3IsEnabled,
      boolean radioButton4IsEnabled,
      int choseAmebaNr,
      int xCoordinate,
      int yCoordinate,
      int damagePointsOfAmeba) {
    assertThat(this.game.getActualPlayer(), checkPlayer.checkPlayer(currentPlayer));
    assertThat(
        currentPlayer.getNumbersOfAmebasOffBoard(),
        checkInteger.checkInteger(nrOfAmebasOffBoardBefore));
    assertThat(
        currentPlayer.getNumbersOfAmebasOnBoard(),
        checkInteger.checkInteger(nrOfAmebasOnBoardBefore));

    assertThat(
        phase.getRadioButtonAmeba1IsEnabled(), checkBoolean.checkBoolean(radioButton1IsEnabled));
    assertThat(
        phase.getRadioButtonAmeba2IsEnabled(), checkBoolean.checkBoolean(radioButton2IsEnabled));
    assertThat(
        phase.getRadioButtonAmeba3IsEnabled(), checkBoolean.checkBoolean(radioButton3IsEnabled));
    assertThat(
        phase.getRadioButtonAmeba4IsEnabled(), checkBoolean.checkBoolean(radioButton4IsEnabled));

    assertFalse(phase.getButtonGoToPhase1IsEnabled());
    assertFalse(phase.getButtonSetAmebaIsEnabled());
    assertTrue(phase.getButtonCheckPossibleSquareIsEnabled());

    // Chose ameba nr #:
    switch (choseAmebaNr) {
      case 1:
        {
          phase.fakeClickRadioButton1();
          break;
        }
      case 2:
        {
          phase.fakeClickRadioButton2();
          break;
        }
      case 3:
        {
          phase.fakeClickRadioButton3();
          break;
        }
      case 4:
        {
          phase.fakeClickRadioButton4();
          break;
        }
      default:
        {
          System.out.println(
              "Error in ScriptedGame1.class: unkown case in setAmebaPhaseSetFirstAmebaCheck()!");
          // TODO
          assertTrue(false);
          break;
        }
    }

    assertFalse(phase.getButtonGoToPhase1IsEnabled());
    assertFalse(phase.getButtonSetAmebaIsEnabled());
    assertTrue(phase.getButtonCheckPossibleSquareIsEnabled());

    // Set coordinate:

    phase.setTextTextFieldX(Integer.toString(xCoordinate));
    phase.setTextTextFieldY(Integer.toString(yCoordinate));

    phase.fakeClickCheckPossibleSquare();

    assertFalse(phase.getButtonGoToPhase1IsEnabled());
    assertTrue(phase.getButtonSetAmebaIsEnabled());
    assertTrue(phase.getButtonCheckPossibleSquareIsEnabled());

    // Set ameba:
    phase.fakeClickButtonSetAmeba();

    // Check square:
    assertFalse(this.game.getBoard().getSquare(xCoordinate, yCoordinate).isEmpy());

    // Check ameba
    Ameba newSetAmeba = this.game.getActiveAmeba();

    assertThat(newSetAmeba.getColor(), checkColor.checkColor(currentPlayer.getColor()));
    assertThat(newSetAmeba.getNumber(), checkInteger.checkInteger(choseAmebaNr));
    assertThat(newSetAmeba.getDamagePoints(), checkInteger.checkInteger(damagePointsOfAmeba));

    assertThat(
        this.playerYellow.getNumbersOfAmebasOffBoard(),
        checkInteger.checkInteger(nrOfAmebasOffBoardBefore - 1));
    assertThat(
        this.playerYellow.getNumbersOfAmebasOnBoard(),
        checkInteger.checkInteger(nrOfAmebasOnBoardBefore + 1));
  }