Skip to content

Conversation

@pleasebelieveme
Copy link
Owner

@pleasebelieveme pleasebelieveme commented Nov 3, 2025

  • 여러 개의 로또(List)를 관리
  • 구매한 로또 개수 반환
  • 모든 로또에 대해 당첨 번호와 비교하여 등수 판별 및 LottoResult 반환

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 여러 개의 로또 티켓을 한 번에 관리할 수 있도록 지원합니다.
    • 최소 1개 이상의 티켓 구매 유효성 검증을 추가했습니다.
  • 테스트

    • 다중 티켓 관리 및 유효성 검증에 대한 단위 테스트를 추가했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

새로운 LottoTickets 도메인 클래스가 추가되어 로또 객체 목록을 캡슐화합니다. 생성자에서 입력값 검증(null 확인, 최소 1개 이상)을 수행하며, 로또 개수 조회와 불변 리스트 반환 메서드를 제공합니다. 향후 당첨번호 비교 기능을 위한 스텁도 포함되어 있습니다.

Changes

응집도 / 파일(들) 변경 요약
핵심 도메인 클래스
src/main/java/lotto/domain/LottoTickets.java
Lotto 객체 목록을 관리하는 새로운 LottoTickets 클래스 추가. 생성자에서 null 및 빈 리스트에 대한 유효성 검증 수행. getLottoCount(), getLottos() 메서드와 향후 compareWithWinningLotto() 플레이스홀더 포함.
테스트 코드
src/test/java/lotto/domain/LottoTicketsTest.java
LottoTickets 클래스에 대한 새로운 단위 테스트 클래스 추가. 정상 생성, 개수 조회, null/빈 리스트 예외 케이스 검증 포함.
테스트 정리
src/test/java/lotto/domain/WinningLottoTest.java
불필요한 테스트 주석 정리 (동작 변화 없음).

Sequence Diagram

sequenceDiagram
    actor User
    participant LottoTickets
    
    User->>LottoTickets: new LottoTickets(lottos)
    
    alt lottos is null
        LottoTickets-->>User: ✗ IllegalArgumentException<br/>"[ERROR] 로또 목록이 없습니다."
    else lottos.size() < 1
        LottoTickets-->>User: ✗ IllegalArgumentException<br/>"[ERROR] 최소 1개 이상의 로또를<br/>구매해야 합니다."
    else valid input
        LottoTickets->>LottoTickets: store as final field
        LottoTickets-->>User: ✓ instance created
        User->>LottoTickets: getLottoCount()
        LottoTickets-->>User: count: int
        User->>LottoTickets: getLottos()
        LottoTickets-->>User: unmodifiable List<Lotto>
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • 주의 사항:
    • 생성자의 유효성 검증 로직 확인 (null 체크 순서, 예외 메시지)
    • getLottos()의 불변 리스트 반환 구현 검증 (Collections.unmodifiableList 사용 확인)
    • 테스트 커버리지: 모든 예외 경로와 정상 케이스가 포함되었는지 확인
    • 주석 처리된 compareWithWinningLotto() 메서드의 의도 및 향후 계획 검토

Possibly related PRs

Poem

🐰 로또 뭉치를 모아 담고
검증이 튼튼하게 지킨다네,
최소 하나는 있어야 하고,
null은 무조건 안 된다며!
당첨을 향한 첫 발걸음... 🎰✨

✨ 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 76e787e and 84c4e5a.

📒 Files selected for processing (3)
  • src/main/java/lotto/domain/LottoTickets.java (1 hunks)
  • src/test/java/lotto/domain/LottoTicketsTest.java (1 hunks)
  • src/test/java/lotto/domain/WinningLottoTest.java (2 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.

@pleasebelieveme pleasebelieveme merged commit 91370c6 into main Nov 3, 2025
1 check was pending
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