All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eg.triviaGameExample.fitnesseFixtures.AddRemovePlayerFixture Maven / Gradle / Ivy

There is a newer version: 20241026
Show newest version
package eg.triviaGameExample.fitnesseFixtures;

import eg.triviaGameExample.Game;
import eg.triviaGameExample.Player;

public class AddRemovePlayerFixture {
  private String playerName;
  private Game theGame;

  public void setPlayerName(String playerName) {
    this.playerName = playerName;
  }

  public boolean addPlayer() {
    theGame = StaticGame.theGame;
    Player thePlayer = theGame.addPlayer(playerName);
    return theGame.playerIsPlaying(thePlayer);
  }

  public boolean removePlayer() {
    theGame = StaticGame.theGame;
    Player thePlayer = theGame.getPlayerNamed(playerName);
    theGame.removePlayer(thePlayer);
    return playerWasRemoved(thePlayer);
  }

  private boolean playerWasRemoved(Player aPlayer) {
    return !theGame.playerIsPlaying(aPlayer);
  }

  public int countPlayers() {
    return theGame.getNumberOfPlayers();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy