-
Notifications
You must be signed in to change notification settings - Fork 0
[Test] 생성 시각에 의한 테스트 개선 #112
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
Changes
Sequence Diagram(s)sequenceDiagram
participant 테스트코드
participant Generator
participant DomainUtils
participant Entity
테스트코드->>Generator: Store/Cheer/Article 생성 요청 (createdAt 전달)
Generator->>Entity: 엔티티 생성
Generator->>DomainUtils: setCreatedAt(Entity, createdAt)
DomainUtils->>Entity: createdAt 필드 리플렉션 설정
Generator->>테스트코드: 엔티티 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ 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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. 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도 고생하셨습니다! 🌮
기존 테스트가 어긋나는 지점들이 잘 방어되겠군요
| private DomainUtils() { | ||
| } | ||
|
|
||
| public static <T extends AuditingEntity> void setCreatedAt(T entity, LocalDateTime createdAt) { |
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.
지네릭 좋군요 👍🏻
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/java/eatda/fixture/ArticleGenerator.java (1)
32-36: 타임스탬프 설정 기능이 잘 구현됨기존 로직을 재사용하여 DRY 원칙을 준수하고 있습니다. DomainUtils를 통한 리플렉션 기반 타임스탬프 설정도 적절합니다.
참고로, 현재 구현에서는 article이 두 번 저장됩니다(첫 번째는 generate 메서드에서, 두 번째는 타임스탬프 설정 후). 테스트 코드이므로 성능상 큰 문제는 없지만, 향후 최적화를 고려해볼 수 있습니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/test/java/eatda/controller/article/ArticleControllerTest.java(2 hunks)src/test/java/eatda/fixture/ArticleGenerator.java(2 hunks)src/test/java/eatda/service/article/ArticleServiceTest.java(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: lvalentine6
PR: YAPP-Github/26th-Web-Team-1-BE#76
File: src/main/java/eatda/domain/store/Cheer.java:50-61
Timestamp: 2025-07-15T09:42:54.091Z
Learning: Cheer 엔티티의 생성자는 데이터베이스 시딩을 위해 의도적으로 ID 매개변수를 받도록 설계되었습니다. 시드 데이터에서 명시적으로 ID를 설정하기 때문에 이 패턴이 필요합니다.
🧬 Code Graph Analysis (1)
src/test/java/eatda/fixture/ArticleGenerator.java (1)
src/test/java/eatda/util/DomainUtils.java (1)
DomainUtils(7-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (5)
src/test/java/eatda/controller/article/ArticleControllerTest.java (2)
6-6: LGTM! 타임스탬프 기능을 위한 필수 import 추가LocalDateTime import가 올바르게 추가되었습니다.
17-19: 타임스탬프 명시적 설정으로 테스트 안정성 향상명시적인 생성 시각 설정으로 테스트의 일관성과 안정성이 크게 개선되었습니다. 1시간 간격으로 설정하여 타임스탬프 충돌을 효과적으로 방지하고 있습니다.
src/test/java/eatda/fixture/ArticleGenerator.java (1)
6-7: 필요한 import 추가가 올바르게 구현됨DomainUtils와 LocalDateTime import가 새로운 타임스탬프 기능을 위해 적절히 추가되었습니다.
src/test/java/eatda/service/article/ArticleServiceTest.java (2)
7-7: LGTM! 타임스탬프 기능을 위한 필수 importLocalDateTime import가 올바르게 추가되었습니다.
22-27: 타임스탬프 기반 정렬 테스트가 체계적으로 구현됨5개의 아티클을 1시간 간격으로 생성하여 최신순 정렬을 확실하게 테스트할 수 있도록 구현되었습니다. 명시적 타임스탬프 설정으로 테스트의 신뢰성이 크게 향상되었습니다.
|
🎉 This PR is included in version 1.4.0-develop.31 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |



✨ 개요
🧾 관련 이슈
없음
🔍 참고 사항 (선택)
Summary by CodeRabbit
버그 수정
테스트