use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class MatchMakerServiceTest method startSearchBanned.
@Test
public void startSearchBanned() throws Exception {
Player player = new Player();
player.setMatchMakerBanDetails(new MatchMakerBanDetails());
expectedException.expect(requestExceptionWithCode(ErrorCode.BANNED_FROM_MATCH_MAKER));
instance.submitSearch(player, Faction.CYBRAN, QUEUE_NAME);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class MatchMakerServiceTest method submitSearchTwoPlayersDontMatchIfRatingsTooFarApart.
/**
* Tests whether two players whose ratings are too far apart don't get matched.
*/
@Test
public void submitSearchTwoPlayersDontMatchIfRatingsTooFarApart() throws Exception {
Player player1 = (Player) new Player().setLadder1v1Rating((Ladder1v1Rating) new Ladder1v1Rating().setMean(300d).setDeviation(50d)).setLogin(LOGIN_PLAYER_1).setId(1);
Player player2 = (Player) new Player().setLadder1v1Rating((Ladder1v1Rating) new Ladder1v1Rating().setMean(1300d).setDeviation(50d)).setLogin(LOGIN_PLAYER_2).setId(2);
instance.submitSearch(player1, Faction.CYBRAN, QUEUE_NAME);
instance.submitSearch(player2, Faction.AEON, QUEUE_NAME);
instance.processPools();
verify(gameService, never()).createGame(any(), any(), any(), any(), any(), anyInt(), anyInt(), any());
verify(gameService, never()).joinGame(anyInt(), eq(null), any());
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class MatchMakerServiceTest method submitSearchTwoFreshPlayersDontMatchImmediately.
/**
* Tests whether two players who never played a game (and thus have no rating associated) don't match immediately,
* because such players always have a low game quality.
*/
@Test
public void submitSearchTwoFreshPlayersDontMatchImmediately() throws Exception {
Player player1 = (Player) new Player().setLogin(LOGIN_PLAYER_1).setId(1);
Player player2 = (Player) new Player().setLogin(LOGIN_PLAYER_2).setId(2);
properties.getMatchMaker().setAcceptableQualityWaitTime(10);
instance.submitSearch(player1, Faction.CYBRAN, QUEUE_NAME);
instance.submitSearch(player2, Faction.AEON, QUEUE_NAME);
instance.processPools();
verify(gameService, never()).createGame(any(), any(), any(), any(), any(), anyInt(), anyInt(), any());
verify(gameService, never()).joinGame(anyInt(), eq(null), any());
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class MatchMakerServiceTest method startSearchEmptyQueue.
@Test
public void startSearchEmptyQueue() throws Exception {
FeaturedMod featuredMod = new FeaturedMod();
when(modService.getFeaturedMod(1)).thenReturn(Optional.of(featuredMod));
when(modService.isLadder1v1(featuredMod)).thenReturn(true);
instance.submitSearch(new Player(), Faction.CYBRAN, QUEUE_NAME);
instance.processPools();
verifyZeroInteractions(gameService);
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class MatchMakerServiceTest method startSearchAlreadyInGame.
@Test
public void startSearchAlreadyInGame() throws Exception {
Player player = new Player();
player.setCurrentGame(new Game());
expectedException.expect(requestExceptionWithCode(ErrorCode.ALREADY_IN_GAME));
instance.submitSearch(player, Faction.CYBRAN, QUEUE_NAME);
}
Aggregations