/**
   * Verify that when adding a second player to a game, the correct information for that player is
   * set and it does not conflict with the first player
   */
  @Test
  public void addSecondPlayerTest() {
    // setup dummy entityfactory
    EntityFactory dummyEntityFactory = EasyMock.createMock(EntityFactory.class);
    SnowmanFlag dummyFlag = EasyMock.createNiceMock(SnowmanFlag.class);
    EasyMock.expect(dummyFlag.getID()).andStubReturn(new Integer(0));
    EasyMock.replay(dummyFlag);
    EasyMock.expect(
            dummyEntityFactory.createSnowmanFlag(
                EasyMock.isA(SnowmanGame.class),
                EasyMock.isA(ETeamColor.class),
                EasyMock.isA(Coordinate.class),
                EasyMock.isA(Coordinate.class)))
        .andStubReturn(dummyFlag);
    EasyMock.replay(dummyEntityFactory);

    // create the player
    ClientSession session = EasyMock.createNiceMock(ClientSession.class);
    SnowmanPlayer dummyPlayer = EasyMock.createMock(SnowmanPlayer.class);
    ETeamColor color = ETeamColor.Red;

    // create the second player
    ClientSession session2 = EasyMock.createNiceMock(ClientSession.class);
    SnowmanPlayer dummyPlayer2 = EasyMock.createMock(SnowmanPlayer.class);
    ETeamColor color2 = ETeamColor.Blue;

    // create the game
    SnowmanGame game = new SnowmanGameImpl(gameName, 4, dummyEntityFactory);

    // record information that should be set on the player1
    dummyPlayer.setID(1);
    dummyPlayer.setLocation(EasyMock.anyFloat(), EasyMock.anyFloat());
    dummyPlayer.setTeamColor(color);
    dummyPlayer.setGame(game);
    EasyMock.expect(dummyPlayer.getSession()).andStubReturn(session);
    EasyMock.replay(dummyPlayer);

    // record information that should be set on the player2
    dummyPlayer2.setID(2);
    dummyPlayer2.setLocation(EasyMock.anyFloat(), EasyMock.anyFloat());
    dummyPlayer2.setTeamColor(color2);
    dummyPlayer2.setGame(game);
    EasyMock.expect(dummyPlayer2.getSession()).andStubReturn(session2);
    EasyMock.replay(dummyPlayer2);

    // record that the players should be added to the channel
    EasyMock.resetToDefault(gameChannel);
    EasyMock.expect(gameChannel.join(session)).andReturn(gameChannel);
    EasyMock.expect(gameChannel.join(session2)).andReturn(gameChannel);
    EasyMock.replay(gameChannel);

    // add the player
    game.addPlayer(dummyPlayer, color);
    game.addPlayer(dummyPlayer2, color2);

    // verify the calls
    EasyMock.verify(dummyPlayer);
    EasyMock.verify(dummyPlayer2);
    EasyMock.verify(gameChannel);
  }
 /**
  * Expects any float argument. For details, see the EasyMock documentation.
  *
  * @return <code>0</code>.
  */
 protected final float anyFloat() {
   return EasyMock.anyFloat();
 }