### Question:
GameServiceImpl implements GameService { @Override public GameStats retrieveStatsForUser(final Long userId) { Integer score = scoreCardRepository.getTotalScoreForUser(userId); if(score == null) { return new GameStats(userId, 0, Collections.emptyList()); } List<BadgeCard> badgeCards = badgeCardRepository .findByUserIdOrderByBadgeTimestampDesc(userId); return new GameStats(userId, score, badgeCards.stream() .map(BadgeCard::getBadge).collect(Collectors.toList())); } GameServiceImpl(ScoreCardRepository scoreCardRepository,
                    BadgeCardRepository badgeCardRepository,
                    MultiplicationResultAttemptClient attemptClient); @Override GameStats newAttemptForUser(final Long userId,
                                       final Long attemptId,
                                       final boolean correct); @Override GameStats retrieveStatsForUser(final Long userId); @Override ScoreCard getScoreForAttempt(final Long attemptId); static final int LUCKY_NUMBER; }### Answer:
@Test public void retrieveStatsForUserTest() { Long userId = 1L; int totalScore = 1000; BadgeCard badgeCard = new BadgeCard(userId, Badge.SILVER_MULTIPLICATOR); given(scoreCardRepository.getTotalScoreForUser(userId)) .willReturn(totalScore); given(badgeCardRepository.findByUserIdOrderByBadgeTimestampDesc(userId)) .willReturn(Collections.singletonList(badgeCard)); GameStats stats = gameService.retrieveStatsForUser(userId); assertThat(stats.getScore()).isEqualTo(totalScore); assertThat(stats.getBadges()).containsOnly(Badge.SILVER_MULTIPLICATOR); }