use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method reportArmyScoreNotInGame.
@Test
public void reportArmyScoreNotInGame() throws Exception {
Game game = hostGame(player1);
assertThat(player2.getCurrentGame(), is(nullValue()));
instance.reportArmyScore(player2, 1, 10);
assertThat(game.getReportedArmyResults().values(), is(empty()));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method onGameEndedSavesGameIfGameStarted.
@Test
public void onGameEndedSavesGameIfGameStarted() throws Exception {
Game game = hostGame(player1);
launchGame(game);
instance.updatePlayerGameState(PlayerGameState.ENDED, player1);
assertThat(game.getState(), is(GameState.ENDED));
verify(gameRepository).save(game);
verifyZeroInteractions(divisionService);
assertThat(player1.getCurrentGame(), is(game));
assertThat(player1.getGameState(), is(PlayerGameState.ENDED));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method onGameClosedDoesntProcessArmyStatsIfGameDidntStart.
@Test
public void onGameClosedDoesntProcessArmyStatsIfGameDidntStart() throws Exception {
Game game = hostGame(player1);
instance.updatePlayerGameState(PlayerGameState.CLOSED, player1);
assertThat(game.getState(), is(GameState.CLOSED));
verifyZeroInteractions(armyStatisticsService);
verifyZeroInteractions(divisionService);
verify(mapService, never()).incrementTimesPlayed(any());
assertThat(player1.getCurrentGame(), is(nullValue()));
assertThat(player1.getGameState(), is(PlayerGameState.NONE));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method mutualDrawRequestedByObserver.
@Test
public void mutualDrawRequestedByObserver() throws Exception {
Game game = hostGame(player1);
instance.updatePlayerOption(player1, player1.getId(), OPTION_TEAM, GameService.OBSERVERS_TEAM_ID);
launchGame(game);
instance.mutuallyAgreeDraw(player1);
assertThat(game.isMutuallyAgreedDraw(), is(false));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method onGameLaunchingSentByNonHostIsIgnored.
@Test
public void onGameLaunchingSentByNonHostIsIgnored() throws Exception {
Game game = hostGame(player1);
addPlayer(game, player2);
Mockito.reset(clientService);
instance.updatePlayerGameState(PlayerGameState.LAUNCHING, player2);
assertThat(game.getState(), is(GameState.OPEN));
verifyZeroInteractions(clientService);
verify(gameRepository, never()).save(game);
}
Aggregations