Package eg.triviaGameExample.fitnesseFixtures

Source Code of eg.triviaGameExample.fitnesseFixtures.AddRemovePlayerFixture

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();
  }
}
TOP

Related Classes of eg.triviaGameExample.fitnesseFixtures.AddRemovePlayerFixture

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.