-
Notifications
You must be signed in to change notification settings - Fork 0
[Test] StoryControllerTest 가 Mock을 쓰지 않도록 개선 #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough테스트 코드에서 기존에 StoryService를 목(mock)으로 사용하던 방식을 제거하고, 실제 StoryRepository와 ArticleRepository, 그리고 StoryGenerator 픽스처를 주입받아 사용하는 방식으로 변경되었습니다. 이에 따라 StoryControllerTest는 Mockito를 이용한 서비스 계층 스텁(stub) 방식 대신 실제 도메인 객체를 생성하여 통합 테스트 스타일로 검증하도록 리팩터링되었습니다. StoryGenerator 클래스가 신규로 추가되어 테스트용 Story 엔티티 생성을 담당합니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as StoryControllerTest
participant Generator as StoryGenerator
participant Repo as StoryRepository
participant Controller as StoryController
Test->>Generator: Story 생성 요청(generate)
Generator->>Repo: Story 저장(save)
Repo-->>Generator: 저장된 Story 반환
Test->>Controller: API 요청 (예: POST /stories)
Controller->>Repo: Story 조회/저장 등
Repo-->>Controller: 결과 반환
Controller-->>Test: API 응답 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested labels
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 컨트롤러 테스트에서 mockitobean으로 의존성을 모킹한 경우, 상세한 비즈니스 로직 검증보다는 컨트롤러 계층의 동작(라우팅, 파라미터 처리, 응답 구조 등)을 검증하는 것이 ...Applied to files:
🔇 Additional comments (12)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
lvalentine6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번 PR도 고생하셨습니다! 🦖
테스트가 더 견고해졌군요
|
🎉 This PR is included in version 1.4.0-develop.48 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.7.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |



✨ 개요
🧾 관련 이슈
🔍 참고 사항 (선택)
Summary by CodeRabbit