Skip to content

Conversation

@pleasebelieveme
Copy link
Owner

@pleasebelieveme pleasebelieveme commented Nov 3, 2025

Summary by CodeRabbit

릴리스 노트

  • New Features
    • 로또 게임 실행 기능 완성 - 티켓 구매, 당첨 번호 입력, 결과 확인 가능
    • 사용자 입력 인터페이스 - 금액, 당첨 번호, 보너스 번호 입력 받기
    • 게임 결과 화면 - 구매한 티켓, 당첨 통계, 수익률 표시

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

coderabbitai bot commented Nov 3, 2025

Caution

Review failed

The pull request is closed.

로또 애플리케이션 분석

Walkthrough

로또 게임의 핵심 서비스 및 뷰 레이어를 구현합니다. LottoGameService가 게임 흐름을 조율하고, InputView와 OutputView가 사용자 상호작용을 처리하며, LottoResult에 접근자를 추가하고, Lotto.toString()을 구현하고, LOTTO_PRICE를 공개하고, Application에서 의존성을 주입하고, 기존 테스트 메서드를 제거합니다.

Changes

Cohort / File(s) 요약
서비스 계층
src/main/java/lotto/service/LottoGameService.java
로또 게임 워크플로우를 조율하는 새로운 공개 클래스. run() 메서드가 구매 금액 입력, 로또 구매, 당첨 번호 입력, 결과 계산, 통계 출력을 순차적으로 수행하며, 각 단계에서 IllegalArgumentException을 처리하고 OutputView를 통해 보고함.
뷰 계층
src/main/java/lotto/view/InputView.java, src/main/java/lotto/view/OutputView.java
InputView는 구매 금액, 당첨 번호, 보너스 번호 입력을 프롬프트하는 세 가지 메서드 추가. OutputView는 로또 티켓, 당첨 통계, 수익률을 출력하고 에러 메시지를 처리하는 네 가지 공개 메서드 추가.
도메인 모델 업데이트
src/main/java/lotto/domain/Lotto.java, src/main/java/lotto/domain/LottoResult.java
Lotto에 toString() 메서드를 오버라이드하여 "[1, 2, 3, 4, 5, 6]" 형식 반환. LottoResult에 getResult()와 getPurchaseAmount() 접근자 메서드 추가.
유틸리티 및 애플리케이션
src/main/java/lotto/util/LottoGenerator.java, src/main/java/lotto/Application.java
LottoGenerator의 LOTTO_PRICE를 private에서 public으로 변경. Application의 main 메서드에 InputView, OutputView, LottoGenerator 인스턴스화 및 LottoGameService 생성, gameService.run() 호출 추가.
테스트
src/test/java/lotto/ApplicationTest.java, src/test/java/lotto/view/InputView.java
ApplicationTest에서 ERROR_MESSAGE 상수 및 두 개의 테스트 메서드(기능_테스트, 예외_테스트) 제거. 테스트 패키지에 빈 InputView 테스트 클래스 추가.

Sequence Diagram

sequenceDiagram
    actor User
    participant Application
    participant LottoGameService
    participant InputView
    participant OutputView
    participant LottoGenerator
    participant WinningLotto
    
    User->>Application: Run
    Application->>LottoGameService: new & run()
    
    rect rgb(200, 220, 255)
    note over LottoGameService: 구매 금액 입력 루프
    LottoGameService->>InputView: inputPurchaseAmount()
    InputView->>User: 구매 금액 입력 요청
    User-->>InputView: 금액 입력
    InputView-->>LottoGameService: 입력값 반환
    LottoGameService->>LottoGameService: 유효성 검증 & 파싱
    end
    
    rect rgb(200, 255, 220)
    note over LottoGameService: 로또 구매
    LottoGameService->>LottoGenerator: buyLottos(구매금액)
    LottoGenerator-->>LottoGameService: Lotto 리스트
    end
    
    LottoGameService->>OutputView: printLottoTickets(Lotto 리스트)
    OutputView->>User: 구매 티켓 출력
    
    rect rgb(200, 220, 255)
    note over LottoGameService: 당첨 번호 입력 루프
    LottoGameService->>InputView: inputWinningNumbers()
    InputView->>User: 당첨 번호 입력 요청
    User-->>InputView: 번호 입력
    InputView-->>LottoGameService: 입력값 반환
    LottoGameService->>LottoGameService: 파싱 & 검증
    LottoGameService->>InputView: inputBonusNumber()
    InputView->>User: 보너스 번호 입력 요청
    User-->>InputView: 번호 입력
    InputView-->>LottoGameService: 입력값 반환
    LottoGameService->>WinningLotto: new WinningLotto(번호들)
    end
    
    rect rgb(200, 255, 220)
    note over LottoGameService: 결과 계산 및 출력
    LottoGameService->>LottoGameService: calculateResult(Lotto들, WinningLotto)
    LottoGameService->>OutputView: printWinningStatistics(LottoResult)
    OutputView->>User: 당첨 통계 출력
    LottoGameService->>OutputView: printProfitRate(LottoResult)
    OutputView->>User: 수익률 출력
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

주의 깊게 검토해야 할 부분:

  • LottoGameService.java - 복잡한 워크플로우 조율, 입력 검증 루프, 예외 처리 로직이 단계별로 올바르게 구현되었는지 확인
  • OutputView.java - 형식화 로직(MONEY_FORMAT, 소수점 처리)과 Rank별 통계 렌더링이 정확한지 확인
  • 의존성 주입 - Application.java에서 모든 의존성이 올바르게 생성되고 전달되는지 확인
  • Lotto.toString() - 형식이 "[1, 2, 3, 4, 5, 6]"으로 정확하게 구현되었는지 확인
  • LOTTO_PRICE 가시성 변경 - 이 공개로 인한 의도하지 않은 부작용이 없는지 확인

Possibly related PRs

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 849674d and 58d3f10.

📒 Files selected for processing (9)
  • src/main/java/lotto/Application.java (1 hunks)
  • src/main/java/lotto/domain/Lotto.java (1 hunks)
  • src/main/java/lotto/domain/LottoResult.java (1 hunks)
  • src/main/java/lotto/service/LottoGameService.java (1 hunks)
  • src/main/java/lotto/util/LottoGenerator.java (1 hunks)
  • src/main/java/lotto/view/InputView.java (1 hunks)
  • src/main/java/lotto/view/OutputView.java (1 hunks)
  • src/test/java/lotto/ApplicationTest.java (0 hunks)
  • src/test/java/lotto/view/InputView.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