Search in sources :

Example 61 with Game

use of com.faforever.server.entity.Game in project faf-java-server by FAForever.

the class GameServiceTest method reportDesync.

@Test
public void reportDesync() throws Exception {
    Game game = hostGame(player1);
    assertThat(game.getDesyncCounter().intValue(), is(0));
    instance.reportDesync(player1);
    instance.reportDesync(player1);
    instance.reportDesync(player1);
    assertThat(game.getDesyncCounter().intValue(), is(3));
}
Also used : Game(com.faforever.server.entity.Game) Test(org.junit.Test)

Example 62 with Game

use of com.faforever.server.entity.Game in project faf-java-server by FAForever.

the class GameServiceTest method updateGameValidityPrebuiltEnabled.

@Test
public void updateGameValidityPrebuiltEnabled() throws Exception {
    Game game = hostGame(player1);
    game.getOptions().put(OPTION_PREBUILT_UNITS, "On");
    launchGame(game);
    instance.updateGameValidity(game);
    assertThat(game.getValidity(), is(Validity.PREBUILT_ENABLED));
}
Also used : Game(com.faforever.server.entity.Game) Test(org.junit.Test)

Example 63 with Game

use of com.faforever.server.entity.Game in project faf-java-server by FAForever.

the class GameServiceTest method joinGame.

@Test
public void joinGame() throws Exception {
    Game game = hostGame(player1);
    instance.joinGame(game.getId(), game.getPassword(), player2);
    verify(clientService).startGameProcess(game, player2);
    assertThat(player2.getCurrentGame(), is(game));
    assertThat(player2.getGameState(), is(PlayerGameState.INITIALIZING));
    instance.updatePlayerGameState(PlayerGameState.LOBBY, player2);
    assertThat(player2.getCurrentGame(), is(game));
}
Also used : Game(com.faforever.server.entity.Game) Test(org.junit.Test)

Example 64 with Game

use of com.faforever.server.entity.Game in project faf-java-server by FAForever.

the class GameServiceTest method updateGameValidityWrongVictoryConditionEradicationNotCoop.

@Test
public void updateGameValidityWrongVictoryConditionEradicationNotCoop() throws Exception {
    Game game = hostGame(player1);
    game.setVictoryCondition(VictoryCondition.ERADICATION);
    when(modService.isCoop(any())).thenReturn(false);
    launchGame(game);
    instance.updateGameValidity(game);
    assertThat(game.getValidity(), is(Validity.WRONG_VICTORY_CONDITION));
}
Also used : Game(com.faforever.server.entity.Game) Test(org.junit.Test)

Example 65 with Game

use of com.faforever.server.entity.Game in project faf-java-server by FAForever.

the class GameServiceTest method mutualDrawRequestedByPlayer.

@Test
public void mutualDrawRequestedByPlayer() throws Exception {
    Game game = hostGame(player1);
    instance.updatePlayerOption(player1, player1.getId(), OPTION_TEAM, GameService.NO_TEAM_ID);
    launchGame(game);
    instance.mutuallyAgreeDraw(player1);
    assertThat(game.isMutuallyAgreedDraw(), is(true));
}
Also used : Game(com.faforever.server.entity.Game) Test(org.junit.Test)

Aggregations

Game (com.faforever.server.entity.Game)96 Test (org.junit.Test)71 Player (com.faforever.server.entity.Player)26 FeaturedMod (com.faforever.server.entity.FeaturedMod)15 ModVersion (com.faforever.server.entity.ModVersion)12 ConnectionAware (com.faforever.server.client.ConnectionAware)11 Ladder1v1Rating (com.faforever.server.entity.Ladder1v1Rating)11 List (java.util.List)11 ClientService (com.faforever.server.client.ClientService)10 ServerProperties (com.faforever.server.config.ServerProperties)10 RequestException (com.faforever.server.error.RequestException)10 ModService (com.faforever.server.mod.ModService)10 VisibleForTesting (com.google.common.annotations.VisibleForTesting)10 Duration (java.time.Duration)10 Map (java.util.Map)10 Optional (java.util.Optional)10 Slf4j (lombok.extern.slf4j.Slf4j)10 Service (org.springframework.stereotype.Service)10 ArmyResult (com.faforever.server.entity.ArmyResult)9 GamePlayerStats (com.faforever.server.entity.GamePlayerStats)9