Search in sources :

Example 1 with LeaderboardEntry

use of com.faforever.client.leaderboard.LeaderboardEntry in project downlords-faf-client by FAForever.

the class Ladder1V1ControllerTest method setUp.

@Before
public void setUp() throws Exception {
    instance = new Ladder1v1Controller(gameService, preferencesService, playerService, leaderboardService, i18n, new ClientProperties(), eventBus);
    Player player = new Player(USERNAME);
    player.setId(PLAYER_ID);
    currentPlayerProperty = new SimpleObjectProperty<>(player);
    factionList = FXCollections.observableArrayList();
    LeaderboardEntry leaderboardEntry = new LeaderboardEntry();
    leaderboardEntry.setRating(500);
    leaderboardEntry.setWinLossRatio(12.23f);
    leaderboardEntry.setRank(100);
    leaderboardEntry.setGamesPlayed(412);
    leaderboardEntry.setUsername(USERNAME);
    when(leaderboardService.getLadder1v1Stats()).thenReturn(CompletableFuture.completedFuture(new ArrayList<>()));
    when(leaderboardService.getEntryForPlayer(PLAYER_ID)).thenReturn(CompletableFuture.completedFuture(leaderboardEntry));
    when(gameService.searching1v1Property()).thenReturn(searching1v1Property);
    when(preferencesService.getPreferences()).thenReturn(preferences);
    when(preferences.getLadder1v1Prefs()).thenReturn(ladder1V1Prefs);
    when(ladder1V1Prefs.getFactions()).thenReturn(factionList);
    when(preferences.getForgedAlliance()).thenReturn(forgedAlliancePrefs);
    when(playerService.getCurrentPlayer()).thenReturn(Optional.ofNullable(currentPlayerProperty.get()));
    when(playerService.currentPlayerProperty()).thenReturn(currentPlayerProperty);
    loadFxml("theme/play/ranked_1v1.fxml", clazz -> instance);
}
Also used : ClientProperties(com.faforever.client.config.ClientProperties) Player(com.faforever.client.player.Player) ArrayList(java.util.ArrayList) LeaderboardEntry(com.faforever.client.leaderboard.LeaderboardEntry) Before(org.junit.Before)

Aggregations

ClientProperties (com.faforever.client.config.ClientProperties)1 LeaderboardEntry (com.faforever.client.leaderboard.LeaderboardEntry)1 Player (com.faforever.client.player.Player)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1