Skip to content

test: UserService 단위 테스트 추가 + 닉네임 자기재저장 버그 수정 - #216

Merged
unam98 merged 1 commit into
devfrom
tests/user-service-unit-tests
Aug 5, 2026
Merged

test: UserService 단위 테스트 추가 + 닉네임 자기재저장 버그 수정#216
unam98 merged 1 commit into
devfrom
tests/user-service-unit-tests

Conversation

@unam98

@unam98 unam98 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

작업 배경

  • 테스트 커버리지 확장 5단계(JwtService/UserIdResolver → CourseService → RecordService → PublicCourseService → UserService). 마이페이지/닉네임 변경/프로필/탈퇴를 담당하는 UserService에 단위 테스트 추가, 테스트 작성 중 발견한 버그 수정.

변경 사항

영역 내용
UserService.updateUserNickname 유저 조회를 먼저 하고, 요청 닉네임이 현재 닉네임과 같으면 중복 체크를 건너뛰도록 수정
UserServiceTest 4개 메서드 전체에 대해 정상/예외/경계값 테스트 17개 신규

영향 범위

  • updateUserNickname은 이제 본인의 기존 닉네임 그대로 "저장"을 눌러도 에러가 안 남 (기존엔 "이미 존재하는 닉네임"으로 거부됨). 다른 입력값에 대한 동작은 그대로.
  • 런타임 영향 없음 (로직 순서/조건 변경만, 새 의존성/DB 스키마 변경 없음).

검증 매트릭스

영향 범위 테스트 코드
마이페이지 조회 + 레벨 퍼센트 계산 정상_조회
스탬프_없음
스탬프_4개면_한바퀴
존재하지_않는_유저
닉네임 변경 - 중복 체크 + 자기재저장 버그 수정 검증 정상_변경
중복_닉네임
본인_현재_닉네임으로_재저장
존재하지_않는_유저
유저 프로필 조회 + 스크랩 여부 매핑 정상_조회
스크랩_안함
공개한_코스_없음
프로필_유저_없음
요청_유저_없음
회원 탈퇴 - 일반/애플 유저 분기 일반_유저_삭제
애플_유저_토큰_있음
애플_유저_토큰_없음
존재하지_않는_유저

Test Plan

  • 로컬에서 신규 테스트 17개 전부 통과
  • 기존 서비스 테스트들과 함께 실행해도 간섭 없음 확인
  • 로컬 DB/Redis 띄우고 ./gradlew build 전체(기존 ServerApplicationTests 포함) 통과 확인

🤖 Generated with Claude Code

getMyPage/updateUserNickname/getUserProfile/deleteUser 전체 메서드에
대해 정상 케이스 + 예외 케이스 + 경계값 검증 (17개).

테스트 작성 중 발견해서 수정한 버그:
- updateUserNickname: 중복 닉네임 체크를 유저 조회보다 먼저, 그리고
  본인의 현재 닉네임과 비교 없이 수행하고 있어서, 본인의 기존 닉네임을
  그대로 다시 저장하려고 해도 "이미 존재하는 닉네임"으로 거부됐음.
  유저 조회를 먼저 하고, 요청 닉네임이 현재 닉네임과 다를 때만 중복
  체크를 하도록 순서/조건 수정.
@unam98 unam98 self-assigned this Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@unam98, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a28a8e5f-0241-4a1e-9137-04b573d7e97a

📥 Commits

Reviewing files that changed from the base of the PR and between 92e9d55 and 07597e0.

📒 Files selected for processing (2)
  • src/main/java/org/runnect/server/user/service/UserService.java
  • src/test/java/org/runnect/server/user/service/UserServiceTest.java

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.

@unam98
unam98 merged commit a706593 into dev Aug 5, 2026
2 checks passed
@unam98
unam98 deleted the tests/user-service-unit-tests branch August 5, 2026 10:46
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