use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method restoreGameSessionWasNeverInGame.
@Test
public void restoreGameSessionWasNeverInGame() throws Exception {
Game game = hostGame(player1);
launchGame(game);
expectedException.expect(requestExceptionWithCode(ErrorCode.CANT_RESTORE_GAME_NOT_PARTICIPANT));
instance.restoreGameSession(player2, game.getId());
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityMutualDraw.
@Test
public void updateGameValidityMutualDraw() throws Exception {
Game game = hostGame(player1);
game.setMutuallyAgreedDraw(true);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.MUTUAL_DRAW));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityUnevenTeams.
@Test
public void updateGameValidityUnevenTeams() throws Exception {
Player player3 = (Player) new Player().setId(3);
Game game = hostGame(player1);
addPlayer(game, player2);
addPlayer(game, player3);
instance.updatePlayerOption(player1, player1.getId(), OPTION_TEAM, 2);
instance.updatePlayerOption(player1, player2.getId(), OPTION_TEAM, 2);
instance.updatePlayerOption(player1, player3.getId(), OPTION_TEAM, 3);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.UNEVEN_TEAMS));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityAlreadySetThrowsException.
@Test(expected = IllegalStateException.class)
public void updateGameValidityAlreadySetThrowsException() throws Exception {
Game game = hostGame(player1);
game.setValidity(Validity.UNKNOWN_RESULT);
instance.updateGameValidity(game);
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method clearSlot.
@Test
public void clearSlot() throws Exception {
Game game = hostGame(player1);
instance.updatePlayerOption(game.getHost(), player1.getId(), OPTION_SLOT, 2);
addPlayer(game, player2);
instance.updatePlayerOption(player1, 1, OPTION_SLOT, 3);
instance.updatePlayerOption(player1, 1, OPTION_FACTION, 3);
instance.updatePlayerOption(player1, 2, OPTION_SLOT, 4);
instance.updatePlayerOption(player1, 2, OPTION_FACTION, 4);
instance.clearSlot(game, 1);
assertThat(game.getPlayerOptions().containsKey(1), is(true));
assertThat(game.getPlayerOptions().containsKey(2), is(true));
instance.clearSlot(game, 4);
assertThat(game.getPlayerOptions().containsKey(1), is(true));
assertThat(game.getPlayerOptions().containsKey(2), is(false));
instance.clearSlot(game, 3);
assertThat(game.getPlayerOptions().containsKey(1), is(false));
assertThat(game.getPlayerOptions().containsKey(2), is(false));
instance.clearSlot(game, 2);
assertThat(game.getPlayerOptions().containsKey(1), is(false));
assertThat(game.getPlayerOptions().containsKey(2), is(false));
}
Aggregations