use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class TeamKillServiceTest method reportTeamKillWhenVictimIsntReported.
@Test
public void reportTeamKillWhenVictimIsntReported() throws Exception {
Player reporter = new Player();
reporter.setCurrentGame(new Game());
reporter.setId(1);
Player killer = (Player) new Player().setId(2);
Player victim = (Player) new Player().setId(2);
when(playerService.getOnlinePlayer(killer.getId())).thenReturn(Optional.of(killer));
instance.reportTeamKill(reporter, Duration.ofMinutes(28), killer.getId(), victim.getId());
verifyZeroInteractions(teamKillRepository);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class ClientServiceTest method sendIceServers.
@Test
public void sendIceServers() throws Exception {
List<IceServerList> iceServers = Collections.singletonList(new IceServerList(60, Instant.now(), Arrays.asList(new IceServer(URI.create("turn:test1"), null, null, null), new IceServer(URI.create("turn:test2"), "username", "credential", "credentialType"))));
ConnectionAware connectionAware = new Player().setClientConnection(clientConnection);
instance.sendIceServers(iceServers, connectionAware);
verify(clientGateway).send(new IceServersResponse(iceServers), clientConnection);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class ClientServiceTest method disconnectPlayerSendsToAllPlayersInGame.
@Test
public void disconnectPlayerSendsToAllPlayersInGame() throws Exception {
List<Player> recipients = Arrays.asList(player, new Player(), new Player(), new Player());
instance.disconnectPlayerFromGame(12, recipients);
verify(clientGateway, times(4)).send(any(DisconnectPlayerFromGameResponse.class), any());
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class CoopServiceTest method reportOperationCompleteNotInGame.
@Test
public void reportOperationCompleteNotInGame() throws Exception {
expectedException.expect(requestExceptionWithCode(ErrorCode.COOP_CANT_REPORT_NOT_IN_GAME));
instance.reportOperationComplete(new Player(), true, Duration.ofMinutes(1));
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class GameServiceTest method updateGameValidityFreeForAll.
@Test
public void updateGameValidityFreeForAll() throws Exception {
Player player3 = (Player) new Player().setId(3);
Game game = hostGame(player1);
addPlayer(game, player2);
addPlayer(game, player3);
instance.updatePlayerOption(player1, player1.getId(), OPTION_TEAM, 2);
instance.updatePlayerOption(player1, player2.getId(), OPTION_TEAM, 3);
instance.updatePlayerOption(player1, player3.getId(), OPTION_TEAM, 4);
launchGame(game);
game.getReportedArmyResults().put(1, Collections.emptyMap());
game.getReportedArmyResults().put(2, Collections.emptyMap());
game.getReportedArmyResults().put(1, Collections.emptyMap());
game.getReportedArmyResults().put(2, Collections.emptyMap());
instance.updateGameValidity(game);
assertThat(game.getValidity(), is(Validity.FREE_FOR_ALL));
}
Aggregations