use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method enforceRating.
@Test
public void enforceRating() throws Exception {
Game game = hostGame(player1);
assertThat(game.isRatingEnforced(), is(false));
instance.enforceRating(player1);
assertThat(game.isRatingEnforced(), is(true));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityUnitRestriction.
@Test
public void updateGameValidityUnitRestriction() throws Exception {
Game game = hostGame(player1);
addPlayer(game, player2);
game.getOptions().put(OPTION_RESTRICTED_CATEGORIES, 1);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.BAD_UNIT_RESTRICTIONS));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityUnrankedMap.
@Test
public void updateGameValidityUnrankedMap() throws Exception {
Game game = hostGame(player1);
game.getMapVersion().setRanked(false);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.BAD_MAP));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameModsCountDoesntClearIfNonZero.
@Test
public void updateGameModsCountDoesntClearIfNonZero() throws Exception {
List<String> modUids = Arrays.asList("1-1-1-1", "2-2-2-2");
when(modService.findModVersionsByUids(modUids)).thenReturn(Arrays.asList(new ModVersion().setUid("1-1-1-1").setMod(new Mod().setDisplayName("Mod #1")), new ModVersion().setUid("2-2-2-2").setMod(new Mod().setDisplayName("Mod #2"))));
Game game = hostGame(player1);
instance.updateGameMods(game, Arrays.asList("1-1-1-1", "2-2-2-2"));
instance.updateGameModsCount(game, 1);
List<ModVersion> simMods = game.getSimMods();
assertThat(simMods, hasSize(2));
assertThat(simMods.get(0).getUid(), is("1-1-1-1"));
assertThat(simMods.get(0).getMod().getDisplayName(), is("Mod #1"));
assertThat(simMods.get(1).getUid(), is("2-2-2-2"));
assertThat(simMods.get(1).getMod().getDisplayName(), is("Mod #2"));
}
use of com.faforever.server.entity.Game in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityWrongVictoryConditionDominationNotCoop.
@Test
public void updateGameValidityWrongVictoryConditionDominationNotCoop() throws Exception {
Game game = hostGame(player1);
game.setVictoryCondition(VictoryCondition.DOMINATION);
when(modService.isCoop(any())).thenReturn(false);
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.WRONG_VICTORY_CONDITION));
}
Aggregations