use of com.faforever.server.entity.Mod in project faf-java-server by FAForever.
the class GameServiceTest method updateGameMods.
@Test
public void updateGameMods() 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, modUids);
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.Mod 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.Mod in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityUnrankedMod.
@Test
public void updateGameValidityUnrankedMod() throws Exception {
Game game = hostGame(player1);
game.getSimMods().add(new ModVersion().setRanked(false).setMod(new Mod().setDisplayName("Mod")));
launchGame(game);
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.BAD_MOD));
}
use of com.faforever.server.entity.Mod in project faf-java-server by FAForever.
the class GameServiceTest method updateGameModsCountClearsIfZero.
@Test
public void updateGameModsCountClearsIfZero() 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, 0);
assertThat(game.getSimMods(), is(empty()));
}
Aggregations