[Test] Category API 테스트#227
Merged
Merged
Conversation
willjsw
reviewed
Oct 27, 2025
Comment on lines
+71
to
+73
| fieldWithPath("[].categoryId").description("카테고리 ID"), | ||
| fieldWithPath("[].name").description("카테고리명"), | ||
| fieldWithPath("[].depth").description("카테고리 깊이")))); |
Collaborator
There was a problem hiding this comment.
P1: jsonPath() 메소드 사용해주시고, 응답 필드는 저희 사용하고 있는 공통 응답 필드를 참고해서 작성해주시기 바랍니다!
|
|
||
| // When & Then | ||
| mockMvc.perform(get("/categories").with(csrf())) | ||
| .andExpect(status().isOk()) |
Collaborator
There was a problem hiding this comment.
P2: 응답 상태만 확인하는 것으로는 부족할 것 같습니다. andExpect 통해 모든 응답필드가 제대로 반환되고 있는지까지 검증해주세요!
| @DisplayName("카테고리 생성 시 이름이 null이면 400 에러") | ||
| void createCategory_WithNullName_Returns400() throws Exception { | ||
| // Given | ||
| String requestJson = "{\"name\": null, \"parentId\": null}"; |
Collaborator
There was a problem hiding this comment.
P2: 요청을 순수 문자열로 구성하면 이후 코드 변경 시 유지 보수가 어려워집니다! 요청에 필요한 Request 객체를 직접 생성해서 테스트 진행해주세요!
…#217-category-api # Conflicts: # src/test/java/com/irum/come2us/domain/category/CategoryControllerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🛠️ Issue Number
closes #217
📌 작업 내용 및 특이사항
필수 테스트 (Controller 6개 엔드포인트)
📚 참고사항
예외/추가 테스트