test: User/Record/PublicCourse 컨트롤러 @WebMvcTest 추가 + sort NPE 수정 - #228
Conversation
GET /api/public-course를 쿼리 파라미터 없이(예: 그냥 /api/public-course) 호출하면
HttpServletRequest.getQueryString()이 null을 반환하는데, SortStatusIdResolver가
이를 null 체크 없이 split()하다가 NPE(500)로 이어지던 버그를 테스트 작성 중 발견해
수정했다. sort 키가 없는 경우와 동일하게 기본값("date")으로 처리하도록 했다.
|
Warning Review limit reached
Next review available in: 41 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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 |
작업 배경
GET /api/public-course를 쿼리 파라미터 없이 호출하면 500이 발생하는 실제 버그를 발견해 함께 수정했다.변경 사항
common/resolver/sort/SortStatusIdResolver.javarequest.getQueryString()이 null일 때(쿼리 파라미터가 전혀 없을 때) NPE로 500이 나던 버그 수정 — sort 키가 없는 경우와 동일하게 기본값("date")으로 처리user/controller/UserControllerTest.java(신규)record/controller/RecordControllerTest.java(신규)publicCourse/controller/PublicCourseControllerTest.java(신규)영향 범위
GET /api/public-course(퍼블릭 코스 추천/메인 피드 엔드포인트)를 쿼리 파라미터 없이 호출하면(흔한 실제 클라이언트 호출 패턴)HttpServletRequest.getQueryString()이 null을 반환해SortStatusIdResolver가null.split()으로 NPE → 500을 반환하던 버그. sort 키만 없는 경우(예:?pageNo=1)는 이미 정상 처리되고 있었어서 그동안 드러나지 않았던 것으로 보인다. 이번 수정으로 쿼리 파라미터가 아예 없어도 기본 정렬("date")로 정상 처리된다.recommendPublicCourse의pageNo에@Positive가 붙어있지만 컨트롤러 클래스에@Validated가 없어 실제로는 검증되지 않는다 (UserController의appleAccessToken@NotBlank도 동일한 패턴). 테스트에는 실제 동작 그대로 반영했고, 별도 이슈로 남겨둔다.검증 매트릭스
정상_조회존재하지_않는_유저정상_변경닉네임_빈값정상_조회정상_삭제애플토큰_헤더_없음정상_생성제목_없음정상_조회정상_수정제목_없음정상_삭제목록_비어있음정상_조회정렬값_유효하지_않음페이지번호_0이어도_검증되지_않음정상_검색검색어_없음정상_조회정상_생성제목_없음존재하지_않음정상_조회정상_조회정상_삭제목록_비어있음정상_수정제목_없음소유권_없음Test Plan
./gradlew test전체 243/243 통과🤖 Generated with Claude Code