use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityNoRushEnabled.
@Test
public void updateGameValidityNoRushEnabled() throws Exception {
Game game = hostGame(player1);
game.getOptions().put(OPTION_NO_RUSH, "On");
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.NO_RUSH_ENABLED));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method joinGameWrongPassword.
@Test
public void joinGameWrongPassword() throws Exception {
Game game = hostGame(player1);
game.setPassword("pw");
expectedException.expect(requestExceptionWithCode(ErrorCode.INVALID_PASSWORD));
instance.joinGame(game.getId(), "PW", player2);
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateAiOptionArmy.
@Test
public void updateAiOptionArmy() throws Exception {
Game game = hostGame(player1);
assertThat(game.getAiOptions().containsKey(QAI), is(false));
instance.updateAiOption(player1, QAI, OPTION_ARMY, 2);
assertThat(game.getAiOptions().get(QAI).get(OPTION_ARMY), is(2));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityFreeForAll.
@Test
public void updateGameValidityFreeForAll() 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, 3);
instance.updatePlayerOption(player1, player3.getId(), OPTION_TEAM, 4);
launchGame(game);
game.getReportedArmyResults().put(1, Collections.emptyMap());
game.getReportedArmyResults().put(2, Collections.emptyMap());
game.getReportedArmyResults().put(1, Collections.emptyMap());
game.getReportedArmyResults().put(2, Collections.emptyMap());
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.FREE_FOR_ALL));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method onGameClosedDoesntSaveGameIfGameDidntStart.
@Test
public void onGameClosedDoesntSaveGameIfGameDidntStart() throws Exception {
Game game = hostGame(player1);
instance.updatePlayerGameState(PlayerGameState.CLOSED, player1);
assertThat(game.getState(), is(GameState.CLOSED));
verify(gameRepository, never()).save(any(Game.class));
verifyZeroInteractions(divisionService);
assertThat(player1.getCurrentGame(), is(nullValue()));
assertThat(player1.getGameState(), is(PlayerGameState.NONE));
}
Aggregations