use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method reportArmyStatistics.
@Test
public void reportArmyStatistics() throws Exception {
Game game = hostGame(player1);
assertThat(game.getArmyStatistics(), is(empty()));
instance.reportArmyStatistics(player1, Arrays.asList(new ArmyStatistics(), new ArmyStatistics()));
assertThat(game.getArmyStatistics(), is(notNullValue()));
assertThat(game.getArmyStatistics(), hasSize(2));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method onGameClosedProcessesStatsIfGameStarted.
@Test
public void onGameClosedProcessesStatsIfGameStarted() throws Exception {
Game game = hostGame(player1);
launchGame(game);
instance.updatePlayerGameState(PlayerGameState.CLOSED, player1);
assertThat(game.getState(), is(GameState.CLOSED));
verify(armyStatisticsService).process(any(), eq(game), any());
verifyZeroInteractions(divisionService);
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 simpleValidGameWithoutEnded.
@Test
public void simpleValidGameWithoutEnded() throws Exception {
Game game = hostGame(player1);
addPlayer(game, player2);
launchGame(game);
Stream.of(player1, player2).forEach(player -> {
instance.reportArmyOutcome(player, 2, Outcome.DEFEAT);
instance.reportArmyScore(player, 2, -1);
instance.reportArmyOutcome(player, 1, Outcome.VICTORY);
instance.reportArmyScore(player, 1, 10);
});
assertThat(game.getValidity(), is(Validity.VALID));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityUnknownResult.
@Test
public void updateGameValidityUnknownResult() throws Exception {
Game game = hostGame(player1);
addPlayer(game, player2);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.UNKNOWN_RESULT));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method reportArmyScoreAiScore.
@Test
public void reportArmyScoreAiScore() throws Exception {
Game game = hostGame(player1);
instance.updatePlayerOption(player1, player1.getId(), OPTION_ARMY, 1);
instance.updateAiOption(player1, "QAI", OPTION_ARMY, 2);
instance.reportArmyScore(player1, 1, 10);
instance.reportArmyScore(player1, 2, -1);
assertThat(game.getReportedArmyResults().values(), hasSize(1));
assertThat(game.getReportedArmyResults().get(player1.getId()).values(), hasSize(2));
}
Aggregations