eg.triviaGameExample.fitnesseFixtures.AddRemovePlayerFixture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
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();
}
}