use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class SocialServiceTest method onAuthenticationSuccessNullRelations.
@Test
public void onAuthenticationSuccessNullRelations() throws Exception {
User user = (User) new User().setPlayer(new Player().setSocialRelations(null)).setPassword("pw").setLogin("junit");
FafUserDetails userDetails = new FafUserDetails(user);
instance.onPlayerOnlineEvent(new PlayerOnlineEvent(this, userDetails.getPlayer()));
verify(clientService, never()).sendSocialRelations(any(), any());
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class SocialServiceTest method setUp.
@Before
public void setUp() throws Exception {
requester = (Player) new Player().setId(1);
instance = new SocialService(socialRelationRepository, clientService);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class TeamKillServiceTest method reportTeamKillWhenKillerDoesntExist.
@Test
public void reportTeamKillWhenKillerDoesntExist() throws Exception {
Player player = new Player();
player.setCurrentGame(new Game());
player.setId(1);
when(playerService.getOnlinePlayer(player.getId())).thenReturn(Optional.of(player));
instance.reportTeamKill(player, Duration.ofMinutes(28), 991234, player.getId());
verifyZeroInteractions(teamKillRepository);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class TeamKillServiceTest method reportTeamKill.
@Test
public void reportTeamKill() throws Exception {
Game game = new Game();
game.setId(10);
Player player = (Player) new Player().setCurrentGame(game).setId(1);
Player killer = (Player) new Player().setId(2);
when(playerService.getOnlinePlayer(player.getId())).thenReturn(Optional.of(player));
when(playerService.getOnlinePlayer(killer.getId())).thenReturn(Optional.of(killer));
instance.reportTeamKill(player, Duration.ofMinutes(28), killer.getId(), player.getId());
ArgumentCaptor<TeamKill> captor = ArgumentCaptor.forClass(TeamKill.class);
verify(teamKillRepository).save(captor.capture());
TeamKill teamKill = captor.getValue();
assertThat(teamKill.getGameId(), is(game.getId()));
assertThat(teamKill.getTeamKiller(), is(killer.getId()));
assertThat(teamKill.getVictim(), is(player.getId()));
assertThat(teamKill.getGameTime(), is((int) Duration.ofMinutes(28).getSeconds()));
assertThat(teamKill.getReportedAt().after(Timestamp.from(Instant.now().minusSeconds(10))), is(true));
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class TeamKillServiceTest method reportTeamKillWithoutGame.
@Test
public void reportTeamKillWithoutGame() throws Exception {
Player player = (Player) new Player().setId(1);
Player killer = (Player) new Player().setId(2);
when(playerService.getOnlinePlayer(player.getId())).thenReturn(Optional.of(player));
when(playerService.getOnlinePlayer(killer.getId())).thenReturn(Optional.of(killer));
instance.reportTeamKill(player, Duration.ofMinutes(28), killer.getId(), player.getId());
verifyZeroInteractions(teamKillRepository);
}
Aggregations