Conversation
📝 WalkthroughWalkthroughThis PR implements a new authenticated endpoint ChangesMy Roommate Posts Query Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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 docstrings
🧪 Generate unit tests (beta)
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: 1
🤖 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/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java`:
- Around line 67-87: The test's DisplayName claims "최신순" but it only verifies
that the mocked roommatePostGetService result order is preserved; update the
DisplayName of the OPEN_CLOSED_모두_반환 test to reflect that it returns all
OPEN/CLOSED posts in the input order (e.g., "입력 순서대로 모든 OPEN/CLOSED 글을 반환한다"),
or alternatively change the setup to mock sorted results if you intend to test
sorting; refer to the OPEN_CLOSED_모두_반환 method, roommatePostUseCase.getMyPosts
call, and the roommatePostGetService mock when making the change.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0fd89da2-3f78-4af7-8a4c-5cd69ceffe1b
📒 Files selected for processing (8)
.claude/features/post/007_get_my_roommate_posts.yamlsrc/main/java/com/project/bangjjack/domain/post/application/dto/response/MyRoommatePostResponse.javasrc/main/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCase.javasrc/main/java/com/project/bangjjack/domain/post/domain/repository/RoommatePostRepository.javasrc/main/java/com/project/bangjjack/domain/post/domain/service/RoommatePostGetService.javasrc/main/java/com/project/bangjjack/domain/post/presentation/RoommatePostController.javasrc/main/java/com/project/bangjjack/domain/post/presentation/response/PostResponseCode.javasrc/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java
| @DisplayName("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다") | ||
| void OPEN_CLOSED_모두_반환() { | ||
| // given | ||
| Long userId = 10L; | ||
| User owner = user(userId); | ||
| RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1); | ||
| RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2); | ||
| given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost)); | ||
| given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L))) | ||
| .willReturn(Map.of(1L, 1L, 2L, 3L)); | ||
|
|
||
| // when | ||
| List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId); | ||
|
|
||
| // then | ||
| assertThat(result).hasSize(2); | ||
| assertThat(result.get(0).postId()).isEqualTo(1L); | ||
| assertThat(result.get(0).isClosed()).isFalse(); | ||
| assertThat(result.get(1).postId()).isEqualTo(2L); | ||
| assertThat(result.get(1).isClosed()).isTrue(); | ||
| } |
There was a problem hiding this comment.
정렬 검증 의도와 실제 검증 대상이 다릅니다.
Line 67의 “최신순”은 RoommatePostGetService를 mock으로 대체한 현재 테스트에서 보장되지 않습니다. 이 테스트는 정렬 로직 자체가 아니라 “입력 순서 보존”만 확인하고 있어, 이름/설명을 맞추는 게 정확합니다.
✅ Suggested update
- `@DisplayName`("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다")
+ `@DisplayName`("내가 작성한 OPEN/CLOSED 글을 모두 반환하고 입력 순서를 보존한다")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @DisplayName("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다") | |
| void OPEN_CLOSED_모두_반환() { | |
| // given | |
| Long userId = 10L; | |
| User owner = user(userId); | |
| RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1); | |
| RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2); | |
| given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost)); | |
| given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L))) | |
| .willReturn(Map.of(1L, 1L, 2L, 3L)); | |
| // when | |
| List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId); | |
| // then | |
| assertThat(result).hasSize(2); | |
| assertThat(result.get(0).postId()).isEqualTo(1L); | |
| assertThat(result.get(0).isClosed()).isFalse(); | |
| assertThat(result.get(1).postId()).isEqualTo(2L); | |
| assertThat(result.get(1).isClosed()).isTrue(); | |
| } | |
| `@DisplayName`("내가 작성한 OPEN/CLOSED 글을 모두 반환하고 입력 순서를 보존한다") | |
| void OPEN_CLOSED_모두_반환() { | |
| // given | |
| Long userId = 10L; | |
| User owner = user(userId); | |
| RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1); | |
| RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2); | |
| given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost)); | |
| given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L))) | |
| .willReturn(Map.of(1L, 1L, 2L, 3L)); | |
| // when | |
| List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId); | |
| // then | |
| assertThat(result).hasSize(2); | |
| assertThat(result.get(0).postId()).isEqualTo(1L); | |
| assertThat(result.get(0).isClosed()).isFalse(); | |
| assertThat(result.get(1).postId()).isEqualTo(2L); | |
| assertThat(result.get(1).isClosed()).isTrue(); | |
| } |
🤖 Prompt for 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.
In
`@src/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java`
around lines 67 - 87, The test's DisplayName claims "최신순" but it only verifies
that the mocked roommatePostGetService result order is preserved; update the
DisplayName of the OPEN_CLOSED_모두_반환 test to reflect that it returns all
OPEN/CLOSED posts in the input order (e.g., "입력 순서대로 모든 OPEN/CLOSED 글을 반환한다"),
or alternatively change the setup to mock sorted results if you intend to test
sorting; refer to the OPEN_CLOSED_모두_반환 method, roommatePostUseCase.getMyPosts
call, and the roommatePostGetService mock when making the change.
🔗 관련 이슈
✅ PR 유형
어떤 변경 사항이 있었나요?
✏️ 작업 내용
내가 쓴 모집글 목록 조회 기능을 구현했습니다.
💡 추가 사항
Summary by CodeRabbit
Release Notes