✨ [OMF-339] 단위 테스트 추가 - Member 도메인 (PR 2/3)#157
Conversation
- MemberTest: 코인 증감, 포인트, 동의 정책, 온보딩, 상태 변경 등 엔티티 비즈니스 로직 (14개) - MemberQueryServiceTest: 조회, 검색, 위임 로직 (7개) - MemberModifyServiceTest: upsertMember(신규/기존), 프로필, 온보딩, 삭제 (9개)
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough이 PR은 Member 도메인 엔티티 및 관련 서비스 클래스에 대한 포괄적인 JUnit 테스트 스위트를 추가합니다. 동전 작업, 동의 정책, 프로필 관리, 온보딩 및 저장소 위임 패턴을 검증합니다. ChangesMember Domain Test Coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/test/java/OneQ/OnSurvey/domain/member/MemberTest.java`:
- Around line 83-92: Add a negative-boundary test for decreaseCoin in
MemberTest: add a new assertion that calling member.decreaseCoin(-1L) throws
CustomException with error code CoinErrorCode.COIN_NOT_POSITIVE, mirroring the
existing zero-case; reference the existing test method
decreaseCoin_zero_throwsException and the classes/members Member, decreaseCoin,
CustomException, and CoinErrorCode when adding the new test case.
- Around line 104-113: Add a test in MemberTest that verifies
Member.increasePromotionPoint throws the same CustomException with
CoinErrorCode.COIN_NOT_POSITIVE when passed a negative value; locate the test
class MemberTest and add a new `@Test` (e.g.,
increasePromotionPoint_negative_throwsException) which constructs a Member via
buildMember() and asserts that calling member.increasePromotionPoint(-1L)
results in the CustomException whose getErrorCode() equals
CoinErrorCode.COIN_NOT_POSITIVE, mirroring the existing zero-case assertion
style.
In
`@src/test/java/OneQ/OnSurvey/domain/member/service/MemberModifyServiceTest.java`:
- Around line 88-103: Test currently mixes serviceAgreed with marketingAgreed;
update the test method upsertMember_withServiceAgreed_setsServiceAgreedTrue to
pass only "serviceAgreed" in the DecryptedLoginMeResponse scopes, set
marketingAgreed expectation to false, and assert result.isServiceAgreed() is
true and result.isMarketingAgreed() is false so the
MemberModifyService.upsertMember behavior for service-only consent is verified
in isolation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56c4fbdd-0770-4338-b348-3d02e3724f74
📒 Files selected for processing (3)
src/test/java/OneQ/OnSurvey/domain/member/MemberTest.javasrc/test/java/OneQ/OnSurvey/domain/member/service/MemberModifyServiceTest.javasrc/test/java/OneQ/OnSurvey/domain/member/service/MemberQueryServiceTest.java
✨ Related Issue
OMF-339 단위 테스트 작성 - Member 도메인 (PR 2/3)
📌 Task Details
Member 도메인 서비스 레이어 및 엔티티 비즈니스 로직을 Mockito 기반으로 커버합니다.
테스트 대상 (총 30개 테스트 케이스)
MemberTest(14개) — Member 엔티티 비즈니스 로직increaseCoin/decreaseCoin: 양수 검증, 부족 시 예외, 0 이하 예외increasePromotionPoint: 0 이하 예외update: null 필드 무시 검증updateAgreePolicy: SERVICE_AGREED / MARKETING_AGREED / null 처리memberConnectOut: TOSS_CONNECT_OUT 상태 변경completeOnboarding: 거주지·관심사 설정, null interests 처리MemberQueryServiceTest(7개) — 조회 서비스getMemberByUserKey: 존재/미존재 케이스getMemberInfo: 응답 필드 정확성, 미존재 예외validateAdminRoleAndGetMemberIdByUserKey: repository 위임 확인searchMembers: 목록 변환, 빈 목록getUsernameByUserKey: repository 위임 확인MemberModifyServiceTest(9개) — 수정/삭제 서비스upsertMember: 기존 멤버 업데이트 vs 신규 생성, 동의 정책 처리changeMemberStatusTossConnectOut: 상태 변경 및 저장 검증changeProfileImage: 존재/미존재completeOnboarding: 존재/미존재deleteById: repository 위임 확인전체 PR 계획 (3개로 재구성)
💬 Review Requirements (Optional)
없음