Skip to content

Conversation

@pleasebelieveme
Copy link
Owner

@pleasebelieveme pleasebelieveme commented Nov 3, 2025

  • 음수, 0, 1000원 미만, 1000원 단위 오류 검증 및 예외 처리

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 구입 금액 검증 기능이 추가되었습니다. 음수, 0, 1,000원 미만, 1,000원 단위 미준수 금액에 대해 각각의 명확한 오류 메시지를 제공합니다.
  • 테스트

    • 구입 금액 검증 시나리오에 대한 테스트 모음이 추가되었습니다.

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

coderabbitai bot commented Nov 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

구입 금액 검증을 위한 유틸리티 클래스 InputValidator를 추가했습니다. validatePurchaseAmount() 메서드가 양수 여부, 영값 확인, 1000원 이상 여부, 1000원 단위 배수 확인 등 네 가지 검증 규칙을 순차적으로 실행하며, 각 위반 시 특정 한국어 오류 메시지와 함께 IllegalArgumentException을 발생시킵니다. 상응하는 단위 테스트도 추가되었습니다.

Changes

코호트 / 파일 변경 요약
검증 로직 구현
src/main/java/lotto/validator/InputValidator.java
새로운 InputValidator 유틸리티 클래스 추가. validatePurchaseAmount(int amount) 공개 정적 메서드 구현으로 구입 금액 검증(양수 확인, 1000원 이상 확인, 1000원 단위 배수 확인) 및 실패 시 특정 한국어 오류 메시지와 함께 IllegalArgumentException 발생
검증 로직 테스트
src/test/java/lotto/validator/InputValidatorTest.java
새로운 테스트 클래스 추가. 정상 입력값(1000, 8000, 10000), 음수(-1, -1000), 영값(0), 1000원 미만(1, 500, 999), 1000원 단위 미충족(1001, 1500, 8001) 등 다섯 가지 검증 시나리오를 JUnit 5 매개변수화 테스트 및 AssertJ로 검증

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10분

  • 검증 로직이 명확하고 단순한 구조
  • 예외 메시지 및 검증 규칙이 명확한지 확인 필요
  • 테스트 커버리지가 모든 검증 시나리오를 포함하는지 확인

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 e635f45 and f852873.

📒 Files selected for processing (2)
  • src/main/java/lotto/validator/InputValidator.java (1 hunks)
  • src/test/java/lotto/validator/InputValidatorTest.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