Skip to content

Conversation

@pleasebelieveme
Copy link
Owner

@pleasebelieveme pleasebelieveme commented Nov 3, 2025

  • 등수별 당첨 개수 저장 및 반환
  • 총 수익금 및 수익률 계산 (소수점 둘째 자리 반올림)
  • 유효성 검증 (구매 금액 0 초과)"

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 로또 당첨 결과를 등급별로 집계하여 관리할 수 있는 기능 추가
    • 구매 금액 기준 총 수익과 수익률(소수점 첫째 자리까지)을 자동으로 계산
    • 구매 금액 유효성 검증 강화
  • Tests

    • 로또 결과 집계 및 수익 계산에 대한 단위 테스트 추가

@pleasebelieveme pleasebelieveme merged commit 8d8cbbf into main Nov 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

로또 결과를 집계하고 보고하는 새로운 도메인 클래스 LottoResult를 도입합니다. 구매 금액을 검증하고, 당첨 등급별 개수를 집계하며, 총 상금과 수익률을 계산하는 기능을 제공합니다. 해당 테스트 클래스도 추가되었습니다.

Changes

코호트 / 파일(들) 변경 요약
LottoResult 도메인 클래스
src/main/java/lotto/domain/LottoResult.java
새로운 클래스 추가. 생성자에서 purchaseAmount 검증(0보다 커야 함). 당첨 등급만 필터링하여 EnumMap<Rank, Integer>에 개수 집계. getPrizeCount(), calculateTotalProfit(), calculateProfitRate() 메서드 제공. 수익률은 소수점 첫째 자리로 포맷팅("%.1f").
LottoResult 테스트 클래스
src/test/java/lotto/domain/LottoResultTest.java
새로운 테스트 클래스 추가. JUnit 5 및 AssertJ 사용. 등급별 상금 개수 저장, 총 상금 계산, 수익률 포맷팅(소수점 첫째 자리 반올림), 입력 검증 오류 처리 테스트.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • 새로운 클래스이므로 기존 코드와의 상호작용 검토 필요
  • Rank.isWinning() 메서드 및 prize 속성이 올바르게 사용되는지 확인
  • 수익률 계산 및 포맷팅 로직의 정확성 (소수점 첫째 자리 반올림)
  • IllegalArgumentException 메시지 일관성 검증

Possibly related PRs

  • Pleasebelieveme #2: LottoResultRank 열거형의 isWinning() 메서드와 prize 값을 사용하므로, 해당 PR에서 Rank 열거형이 도입된 것과 직접적으로 연결됨.

Poem

🐰 새로운 결과 클래스가 탄생했네,
당첨 등급을 모두 담아내고,
상금도 계산하고 수익률도 맞춰,
소수점 첫째 자리까지 정확하게!
테스트도 든든히, 모든 게 완벽해~✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pleasebelieveme

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91370c6 and 6f18405.

📒 Files selected for processing (2)
  • src/main/java/lotto/domain/LottoResult.java (1 hunks)
  • src/test/java/lotto/domain/LottoResultTest.java (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants