// Path: src/main/java/pl/setblack/pongi/scores/GameResult.java
// public enum GameResult {
//     WON(ScoreRules.SCORE_FOR_WIN),
//     LOST(ScoreRules.SCORE_FOR_LOSS);
// 
//     public final int score;
// 
//     GameResult(int score) {
//         this.score = score;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/ScoreRecord.java
// @Immutable
// public class ScoreRecord {
//     public final String userId;
//     public final GameResult result;
//     public final int playerScored;
//     public final int opponentScore;
//     public final String gameId;
// 
//     public ScoreRecord(
//             String userId,
//             GameResult result,
//             int playerScore,
//             int opponentScore,
//             String gameId) {
//         this.userId = userId;
//         this.result = result;
//         this.playerScored = playerScore;
//         this.opponentScore = opponentScore;
//         this.gameId = gameId;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/ScoreRules.java
// public final class ScoreRules {
//     public static final int SCORE_FOR_WIN = 5;
//     public static final int SCORE_FOR_LOSS = 0;
// 
// }


import javaslang.collection.List;
import org.junit.jupiter.api.Test;
import pl.setblack.pongi.scores.GameResult;
import pl.setblack.pongi.scores.ScoreRecord;
import pl.setblack.pongi.scores.ScoreRules;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
    @Test
    public void shouldReturnOnly5Elements() {
        recordTestGames();
        assertThat( testee.getTopScores(5).size(),
                is (equalTo(5) ));
    }

    private void recordTestGames() {
        for ( int j =0 ; j < 12 ; j++) {
            for (int i = 0; i < j; i++) {
                final List<ScoreRecord> game = makeGameScore("jacek" + i, "placek" + i);
                testee.registerScore(game);
            }
        }
    }

    private List<ScoreRecord> makeGameScore(final String winner, final String loser) {
        return List.of( singleWin(winner), singleLoss(loser));
    }

    private ScoreRecord singleWin(final String userId) {
        return new ScoreRecord(userId,
                GameResult.WON,
                15,
                5,
                "game1"
        );
    }

    private ScoreRecord singleLoss(final String userId) {
// Path: src/main/java/pl/setblack/pongi/scores/GameResult.java
// public enum GameResult {
//     WON(ScoreRules.SCORE_FOR_WIN),
//     LOST(ScoreRules.SCORE_FOR_LOSS);
// 
//     public final int score;
// 
//     GameResult(int score) {
//         this.score = score;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/ScoreRecord.java
// @Immutable
// public class ScoreRecord {
//     public final String userId;
//     public final GameResult result;
//     public final int playerScored;
//     public final int opponentScore;
//     public final String gameId;
// 
//     public ScoreRecord(
//             String userId,
//             GameResult result,
//             int playerScore,
//             int opponentScore,
//             String gameId) {
//         this.userId = userId;
//         this.result = result;
//         this.playerScored = playerScore;
//         this.opponentScore = opponentScore;
//         this.gameId = gameId;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/ScoreRules.java
// public final class ScoreRules {
//     public static final int SCORE_FOR_WIN = 5;
//     public static final int SCORE_FOR_LOSS = 0;
// 
// }


// Path: src/test/java/pl/setblack/pongi/scores/repo/ScoresRepositoryBase.java
import javaslang.collection.List;
import org.junit.jupiter.api.Test;
import pl.setblack.pongi.scores.GameResult;
import pl.setblack.pongi.scores.ScoreRecord;
import pl.setblack.pongi.scores.ScoreRules;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

    @Test
    public void shouldReturnOnly5Elements() {
        recordTestGames();
        assertThat( testee.getTopScores(5).size(),
                is (equalTo(5) ));
    }

    private void recordTestGames() {
        for ( int j =0 ; j < 12 ; j++) {
            for (int i = 0; i < j; i++) {
                final List<ScoreRecord> game = makeGameScore("jacek" + i, "placek" + i);
                testee.registerScore(game);
            }
        }
    }

    private List<ScoreRecord> makeGameScore(final String winner, final String loser) {
        return List.of( singleWin(winner), singleLoss(loser));
    }

    private ScoreRecord singleWin(final String userId) {
        return new ScoreRecord(userId,
                GameResult.WON,
                15,
                5,
                "game1"
        );
    }

    private ScoreRecord singleLoss(final String userId) {
        return new ScoreRecord(userId,