コード例 #1
0
ファイル: GameBoardTests.java プロジェクト: gilday/clue-less
  public void testPlayerMayNotMoveToOccupiedHallway() {
    // GIVEN
    // a GameBoard with Professor Plum on his start spot
    // and some other player is on the hallway he must move to
    CluePlayer profPlum = new CluePlayer();
    profPlum.setClueCharacter(ClueCharacter.ProfPlum);
    profPlum.setLocation(profPlum.getClueCharacter().getName());

    CluePlayer msScarlet = new CluePlayer();
    msScarlet.setClueCharacter(ClueCharacter.MsScarlett);
    msScarlet.setLocation("Library-Study");

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

    GameBoard gameBoard = new GameBoard(players);

    // WHEN
    // system asks GameBoard where professor plum may move
    List<GameBoardSpace> possibleMoves = gameBoard.getPossibleMoves(profPlum);

    // THEN
    // GameBoard says there are no possible spaces
    assertEquals(0, possibleMoves.size());
  }
コード例 #2
0
ファイル: GameBoardTests.java プロジェクト: gilday/clue-less
  public void testProfPlumMayMoveFromStartToHallway() {
    // GIVEN
    // a game board with Professor Plum at his start spot
    CluePlayer profPlum = new CluePlayer();
    profPlum.setClueCharacter(ClueCharacter.ProfPlum);
    profPlum.setLocation(profPlum.getClueCharacter().getName());

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

    // WHEN
    // system asks board where Plum can go
    List<GameBoardSpace> possibleMoves = gameBoard.getPossibleMoves(profPlum);

    // THEN
    // board returns HallwaySpace between Study and Library
    assertEquals(1, possibleMoves.size());
    assertEquals("Library-Study", possibleMoves.get(0).getSpaceId());
  }