Search in sources :

Example 6 with MapVersion

use of com.faforever.server.entity.MapVersion in project faf-java-server by FAForever.

the class GameServiceTest method setUp.

@Before
public void setUp() throws Exception {
    MapVersion map = new MapVersion();
    map.setRanked(true);
    player1 = new Player();
    player1.setId(1);
    player1.setLogin(PLAYER_NAME_1);
    player2 = new Player();
    player2.setId(2);
    player2.setLogin(PLAYER_NAME_2);
    FeaturedMod fafFeaturedMod = new FeaturedMod();
    fafFeaturedMod.setTechnicalName(FAF_TECHNICAL_NAME);
    when(gameRepository.findMaxId()).thenReturn(Optional.empty());
    when(mapService.findMap(anyString())).thenReturn(Optional.empty());
    when(mapService.findMap(MAP_NAME)).thenReturn(Optional.of(map));
    when(modService.getFeaturedMod(FAF_TECHNICAL_NAME)).thenReturn(Optional.of(fafFeaturedMod));
    when(playerService.getOnlinePlayer(anyInt())).thenReturn(Optional.empty());
    doAnswer(invocation -> invocation.getArgumentAt(0, Player.class).setGlobalRating(new GlobalRating())).when(ratingService).initGlobalRating(any());
    serverProperties = new ServerProperties();
    serverProperties.getGame().setRankedMinTimeMultiplicator(-10000);
    instance = new GameService(gameRepository, counterService, clientService, mapService, modService, playerService, ratingService, serverProperties, divisionService, entityManager, armyStatisticsService);
    instance.onApplicationEvent(null);
}
Also used : Player(com.faforever.server.entity.Player) ServerProperties(com.faforever.server.config.ServerProperties) GlobalRating(com.faforever.server.entity.GlobalRating) MapVersion(com.faforever.server.entity.MapVersion) FeaturedMod(com.faforever.server.entity.FeaturedMod) Before(org.junit.Before)

Aggregations

MapVersion (com.faforever.server.entity.MapVersion)6 ServerProperties (com.faforever.server.config.ServerProperties)3 FeaturedMod (com.faforever.server.entity.FeaturedMod)3 Game (com.faforever.server.entity.Game)3 Player (com.faforever.server.entity.Player)3 Before (org.junit.Before)3 ConnectionAware (com.faforever.server.client.ConnectionAware)2 RatingService (com.faforever.server.rating.RatingService)2 UUID (java.util.UUID)2 Test (org.junit.Test)2 ClientService (com.faforever.server.client.ClientService)1 GlobalRating (com.faforever.server.entity.GlobalRating)1 Ladder1v1Rating (com.faforever.server.entity.Ladder1v1Rating)1 MapStats (com.faforever.server.entity.MapStats)1 ErrorCode (com.faforever.server.error.ErrorCode)1 RequestException (com.faforever.server.error.RequestException)1 Requests (com.faforever.server.error.Requests)1 Faction (com.faforever.server.game.Faction)1 GameService (com.faforever.server.game.GameService)1 GameVisibility (com.faforever.server.game.GameVisibility)1