示例#1
0
  public void testPlayerMayNotMoveFromHallwayToStartSpace() {
    // GIVEN
    // a game board with Professor Plum at the hallway adjacent to his start spot
    CluePlayer profPlum = new CluePlayer();
    profPlum.setClueCharacter(ClueCharacter.ProfPlum);
    profPlum.setLocation(profPlum.getClueCharacter().getName());

    List<CluePlayer> players = new Vector<CluePlayer>();
    GameBoard board = new GameBoard(players);

    // WHEN
    // system asks is plum may go to start space
    boolean canTravelToStartSpace =
        board.isPlayerAbleToMoveToSpace(profPlum, board.getSpaceById(ClueCharacter.ProfPlumID));

    // THEN
    assertFalse(canTravelToStartSpace);
  }
示例#2
0
  public void testPlayerMayUseSecretPassage() {
    // GIVEN
    // a GameBoard where professor plum is in the study
    CluePlayer profPlum = new CluePlayer();
    profPlum.setClueCharacter(ClueCharacter.ProfPlum);
    profPlum.setLocation(Room.STUDY);

    List<CluePlayer> players = new Vector<CluePlayer>();
    players.add(profPlum);
    GameBoard gameBoard = new GameBoard(players);

    // WHEN
    // system asks if professor plum may move to kitchen a la passage
    boolean mayMoveToConservatory =
        gameBoard.isPlayerAbleToMoveToSpace(profPlum, gameBoard.getSpaces().get(Room.KITCHEN));

    // THEN
    // GameBoard says yes
    assertTrue(mayMoveToConservatory);
  }