diff --git a/resource-server/src/main/java/com/inhabas/api/config/WebConfig.java b/resource-server/src/main/java/com/inhabas/api/config/WebConfig.java index 9a777196..479443a6 100644 --- a/resource-server/src/main/java/com/inhabas/api/config/WebConfig.java +++ b/resource-server/src/main/java/com/inhabas/api/config/WebConfig.java @@ -9,11 +9,8 @@ @Configuration public class WebConfig { - /** - * swagger-ui 에서 따로 snake_case 를 위한 설정을 제공하지 않음. camelCase 를 snake_case 로 변환하기 위한 resolver 등록 - */ @Bean public ModelResolver modelResolver(ObjectMapper objectMapper) { - return new ModelResolver(objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)); + return new ModelResolver(objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE)); } } diff --git a/resource-server/src/main/java/com/inhabas/api/domain/menu/domain/valueObject/MenuId.java b/resource-server/src/main/java/com/inhabas/api/domain/menu/domain/valueObject/MenuId.java index ebdc7e9b..2ce7d3f6 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/menu/domain/valueObject/MenuId.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/menu/domain/valueObject/MenuId.java @@ -16,7 +16,7 @@ public class MenuId implements Serializable { private static final long serialVersionUID = -7661257651938513762L; - @JsonProperty("menu_id") + @JsonProperty("menuId") @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; diff --git a/resource-server/src/test/java/com/inhabas/api/web/BudgetApplicationControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/BudgetApplicationControllerTest.java index 6da88224..a595d07f 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/BudgetApplicationControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/BudgetApplicationControllerTest.java @@ -41,7 +41,7 @@ public void createApplicationTest() throws Exception { mockMvc.perform(post("/budget/application") .contentType(MediaType.APPLICATION_JSON) - .content("{\"title\":\"서버 사용비\", \"date_used\":\"2000-01-01T00:00:00\", \"details\":\"aws 크롤링 비용\", \"outcome\":50000, \"accounts\":\"카카오 01-00022-13204 유동현\"}")) + .content("{\"title\":\"서버 사용비\", \"dateUsed\":\"2000-01-01T00:00:00\", \"details\":\"aws 크롤링 비용\", \"outcome\":50000, \"accounts\":\"카카오 01-00022-13204 유동현\"}")) .andExpect(status().isNoContent()); //then @@ -55,7 +55,7 @@ public void modifyApplicationTest() throws Exception { mockMvc.perform(put("/budget/application") .contentType(MediaType.APPLICATION_JSON) - .content("{\"id\":1,\"title\":\"서버 사용비\", \"date_used\":\"2000-01-01T00:00:00\", \"details\":\"aws 크롤링 비용\", \"outcome\":50000, \"accounts\":\"카카오 01-00022-13204 유동현\", \"application_id\":1}")) + .content("{\"id\":1,\"title\":\"서버 사용비\", \"dateUsed\":\"2000-01-01T00:00:00\", \"details\":\"aws 크롤링 비용\", \"outcome\":50000, \"accounts\":\"카카오 01-00022-13204 유동현\", \"applicationId\":1}")) .andExpect(status().isNoContent()); //then @@ -105,7 +105,7 @@ public void changeApplicationStatusTest() throws Exception { mockMvc.perform(put("/budget/application/1/status") .contentType(MediaType.APPLICATION_JSON) - .content("{\"status\":\"PROCESSED\", \"reject_reason\":\"\"}")) + .content("{\"status\":\"PROCESSED\", \"rejectReason\":\"\"}")) .andExpect(status().isNoContent()); //then diff --git a/resource-server/src/test/java/com/inhabas/api/web/BudgetHistoryControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/BudgetHistoryControllerTest.java index c910f7db..0a1ea251 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/BudgetHistoryControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/BudgetHistoryControllerTest.java @@ -36,7 +36,7 @@ public class BudgetHistoryControllerTest { @Test public void historyCreationFormTest() throws Exception { //given - String jsonOfCreationForm = "{\"date_used\":\"2999-01-01T01:01:00\",\"title\":\" \",\"details\":\"aws 작년 비용\",\"person_received\":12171652,\"income\":-1,\"outcome\":-1}"; + String jsonOfCreationForm = "{\"dateUsed\":\"2999-01-01T01:01:00\",\"title\":\" \",\"details\":\"aws 작년 비용\",\"personReceived\":12171652,\"income\":-1,\"outcome\":-1}"; //when Exception resolvedException = @@ -65,7 +65,7 @@ public void historyCreationFormTest() throws Exception { @Test public void budgetCreationFormWillPassValidationTest() throws Exception { //given - String jsonOfCreationForm = "{\"date_used\":\"2000-01-01T01:01:00\",\"title\":\"서버 운영비\",\"details\":\"aws 작년 비용\",\"person_received\":12171652,\"income\":0,\"outcome\":500000}"; + String jsonOfCreationForm = "{\"dateUsed\":\"2000-01-01T01:01:00\",\"title\":\"서버 운영비\",\"details\":\"aws 작년 비용\",\"personReceived\":12171652,\"income\":0,\"outcome\":500000}"; //when mockMvc.perform(post("/budget/history") @@ -80,7 +80,7 @@ public void budgetCreationFormWillPassValidationTest() throws Exception { @Test public void historyModificationFormTest() throws Exception { //given - String jsonOfCreationForm = "{\"id\":1, \"date_used\":\"2999-01-01T01:01:00\",\"title\":\" \",\"details\":\"aws 작년 비용\",\"person_received\":12171652,\"income\":-1,\"outcome\":-1}"; + String jsonOfCreationForm = "{\"id\":1, \"dateUsed\":\"2999-01-01T01:01:00\",\"title\":\" \",\"details\":\"aws 작년 비용\",\"personReceived\":12171652,\"income\":-1,\"outcome\":-1}"; //when Exception resolvedException = @@ -109,7 +109,7 @@ public void historyModificationFormTest() throws Exception { @Test public void budgetModificationFormWillPassValidationTest() throws Exception { //given - String jsonOfModificationForm = "{\"id\":1,\"date_used\":\"2000-01-01T01:01:00\",\"title\":\"서버 운영비\",\"details\":\"aws 작년 비용\",\"person_received\":12171652,\"income\":0,\"outcome\":500000}"; + String jsonOfModificationForm = "{\"id\":1,\"dateUsed\":\"2000-01-01T01:01:00\",\"title\":\"서버 운영비\",\"details\":\"aws 작년 비용\",\"personReceived\":12171652,\"income\":0,\"outcome\":500000}"; //when mockMvc.perform(put("/budget/history") diff --git a/resource-server/src/test/java/com/inhabas/api/web/CommentControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/CommentControllerTest.java index f641f46d..06add0f1 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/CommentControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/CommentControllerTest.java @@ -79,7 +79,7 @@ void getCommentList() throws Exception { @Test void createNewComment() throws Exception { //given - String jsonRequest = "{\"writerId\":12171652,\"contents\":\"아싸 1등\",\"board_id\":13}"; + String jsonRequest = "{\"writerId\":12171652,\"contents\":\"아싸 1등\",\"boardId\":13}"; Integer newCommentId = 1; given(commentService.create(any(), any())).willReturn(newCommentId); @@ -100,7 +100,7 @@ void createNewComment() throws Exception { @Test void createNewReply() throws Exception { //given - String jsonRequest = "{\"writerId\":12171652,\"contents\":\"아싸 1등\",\"board_id\":13, \"parent_comment_id\":1}"; + String jsonRequest = "{\"writerId\":12171652,\"contents\":\"아싸 1등\",\"boardId\":13, \"parentCommentId\":1}"; Integer newReplyId = 2; given(commentService.create(any(), any())).willReturn(newReplyId); @@ -139,7 +139,7 @@ void tryToSaveTooLongContents() throws Exception { @Test void updateComment() throws Exception { //given - String jsonRequest = "{\"comment_id\":1, \"writerId\":12171652,\"contents\":\"1등이 아니네,,,\",\"boardId\":12}"; + String jsonRequest = "{\"commentId\":1, \"writerId\":12171652,\"contents\":\"1등이 아니네,,,\",\"boardId\":12}"; given(commentService.update(any(), any())).willReturn(1); String responseBody = mockMvc.perform(put("/comment") diff --git a/resource-server/src/test/java/com/inhabas/api/web/LectureControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/LectureControllerTest.java index 9b9156d7..b368b8f5 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/LectureControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/LectureControllerTest.java @@ -56,11 +56,11 @@ public void createLectureTest() throws Exception { .contentType(MediaType.APPLICATION_JSON) .content("{\n" + " \"title\": \"절권도 강의\",\n" + - " \"apply_dead_line\": \"9022-07-31T16:51:33\",\n" + - " \"days_of_weeks\": \"월 수 금\",\n" + + " \"applyDeadLine\": \"9022-07-31T16:51:33\",\n" + + " \"daysOfWeeks\": \"월 수 금\",\n" + " \"place\": \"6호관 623 강의실\",\n" + - " \"curriculum_details\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\",\n" + - " \"participants_limits\": 30,\n" + + " \"curriculumDetails\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\",\n" + + " \"participantsLimits\": 30,\n" + " \"method\": 1,\n" + " \"introduction\": \"호신술을 배워보자\"\n" + "}")) @@ -83,11 +83,11 @@ public void updateLectureTest() throws Exception { .content("{\n" + " \"id\": \"1\",\n" + " \"title\": \"절권도 강의\",\n" + - " \"apply_dead_line\": \"9022-07-31T16:51:33\",\n" + - " \"days_of_weeks\": \"월 수 금\",\n" + + " \"applyDeadLine\": \"9022-07-31T16:51:33\",\n" + + " \"daysOfWeeks\": \"월 수 금\",\n" + " \"place\": \"6호관 623 강의실\",\n" + - " \"curriculum_details\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\",\n" + - " \"participants_limits\": 30,\n" + + " \"curriculumDetails\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\",\n" + + " \"participantsLimits\": 30,\n" + " \"method\": 1,\n" + " \"introduction\": \"호신술을 배워보자\"\n" + "}")) @@ -154,7 +154,7 @@ public void getLectureDetailsTest() throws Exception { " \"major\": \"산업경영공학과\"," + " \"name\": \"유동현\"" + " }," + - " \"co_instructors\": [" + + " \"coInstructors\": [" + " {" + " \"id\": 12345678," + " \"major\": \"스마트모빌리티공학과\"," + @@ -166,15 +166,15 @@ public void getLectureDetailsTest() throws Exception { " \"name\": \"나까무라철수\"" + " }" + " ]," + - " \"apply_dead_line\": \"9022-07-31T17:11:36\"," + - " \"days_of_weeks\": \"월 금\"," + + " \"applyDeadLine\": \"9022-07-31T17:11:36\"," + + " \"daysOfWeeks\": \"월 금\"," + " \"place\": \"구내식당\"," + " \"introduction\": \"호신술을 배워보자\"," + - " \"curriculum_details\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\"," + - " \"participants_limits\": 30," + + " \"curriculumDetails\": \"1주차: 빅데이터에 기반한 공격패턴분석
2주차: ...\"," + + " \"participantsLimits\": 30," + " \"method\": 1," + " \"state\": \"WAITING\"," + - " \"reject_reason\": null," + + " \"rejectReason\": null," + " \"paid\": false," + " \"created\": \"9022-07-23T17:11:36\"," + " \"updated\": null" + @@ -203,42 +203,42 @@ public void getLectureListTest() throws Exception { //then then(lectureService).should(times(1)).getList(any()); JSONAssert.assertEquals("{\n" + - " \"total_pages\": 1,\n" + - " \"total_elements\": 3,\n" + + " \"totalPages\": 1,\n" + + " \"totalElements\": 3,\n" + " \"size\": 6,\n" + " \"content\": [\n" + " {\n" + - " \"lecture_id\": 3,\n" + + " \"lectureId\": 3,\n" + " \"title\": \"title3\",\n" + - " \"chief_id\": 1000003,\n" + + " \"chiefId\": 1000003,\n" + " \"introduction\": \"intro3\",\n" + - " \"apply_deadline\": \"2003-03-03T03:03:03\",\n" + + " \"applyDeadline\": \"2003-03-03T03:03:03\",\n" + " \"status\": \"PROGRESSING\",\n" + " \"method\": 1,\n" + - " \"participants_limits\": 32,\n" + - " \"the_number_of_current_participants\": 4\n" + + " \"participantsLimits\": 32,\n" + + " \"theNumberOfCurrentParticipants\": 4\n" + " },\n" + " {\n" + - " \"lecture_id\": 2,\n" + + " \"lectureId\": 2,\n" + " \"title\": \"title2\",\n" + - " \"chief_id\": 1000002,\n" + + " \"chiefId\": 1000002,\n" + " \"introduction\": \"intro2\",\n" + - " \"apply_deadline\": \"2002-02-02T02:02:02\",\n" + + " \"applyDeadline\": \"2002-02-02T02:02:02\",\n" + " \"status\": \"PROGRESSING\",\n" + " \"method\": 1,\n" + - " \"participants_limits\": 31,\n" + - " \"the_number_of_current_participants\": 3\n" + + " \"participantsLimits\": 31,\n" + + " \"theNumberOfCurrentParticipants\": 3\n" + " },\n" + " {\n" + - " \"lecture_id\": 1,\n" + + " \"lectureId\": 1,\n" + " \"title\": \"title1\",\n" + - " \"chief_id\": 1000001,\n" + + " \"chiefId\": 1000001,\n" + " \"introduction\": \"intro1\",\n" + - " \"apply_deadline\": \"2001-01-01T01:01:01\",\n" + + " \"applyDeadline\": \"2001-01-01T01:01:01\",\n" + " \"status\": \"PROGRESSING\",\n" + " \"method\": 1,\n" + - " \"participants_limits\": 30,\n" + - " \"the_number_of_current_participants\": 2\n" + + " \"participantsLimits\": 30,\n" + + " \"theNumberOfCurrentParticipants\": 2\n" + " }\n" + " ],\n" + " \"number\": 0,\n" + @@ -249,7 +249,7 @@ public void getLectureListTest() throws Exception { " },\n" + " \"first\": true,\n" + " \"last\": true,\n" + - " \"number_of_elements\": 3,\n" + + " \"numberOfElements\": 3,\n" + " \"pageable\": {\n" + " \"offset\": 0,\n" + " \"sort\": {\n" + @@ -257,8 +257,8 @@ public void getLectureListTest() throws Exception { " \"sorted\": true,\n" + " \"unsorted\": false\n" + " },\n" + - " \"page_number\": 0,\n" + - " \"page_size\": 6,\n" + + " \"pageNumber\": 0,\n" + + " \"pageSize\": 6,\n" + " \"paged\": true,\n" + " \"unpaged\": false\n" + " },\n" + @@ -278,7 +278,7 @@ public void updateLectureStatusTest() throws Exception { .contentType(MediaType.APPLICATION_JSON) .content("{\n" + " \"status\": \"PROGRESSING\",\n" + - " \"reject_reason\": null\n" + + " \"rejectReason\": null\n" + "}")) .andExpect(status().isNoContent()); @@ -380,17 +380,17 @@ public void searchStudentsInformation() throws Exception { //then then(studentService).should(times(1)).searchStudents(any(), any()); JSONAssert.assertEquals("{\n" + - " \"total_pages\": 3,\n" + - " \"total_elements\": 51,\n" + + " \"totalPages\": 3,\n" + + " \"totalElements\": 51,\n" + " \"size\": 25,\n" + " \"content\": [\n" + " {\n" + " \"name\": \"홍길동50\",\n" + - " \"member_id\": 1000050,\n" + + " \"memberId\": 1000050,\n" + " \"phone\": \"010-0000-0000\",\n" + " \"email\": \"my@gmail.com\",\n" + - " \"assignment_count\": 0,\n" + - " \"attendance_count\": 0,\n" + + " \"assignmentCount\": 0,\n" + + " \"attendanceCount\": 0,\n" + " \"status\": \"PROGRESS\",\n" + " \"sid\": 50\n" + " }\n" + @@ -403,7 +403,7 @@ public void searchStudentsInformation() throws Exception { " },\n" + " \"first\": false,\n" + " \"last\": true,\n" + - " \"number_of_elements\": 1,\n" + + " \"numberOfElements\": 1,\n" + " \"pageable\": {\n" + " \"offset\": 50,\n" + " \"sort\": {\n" + @@ -411,8 +411,8 @@ public void searchStudentsInformation() throws Exception { " \"sorted\": true,\n" + " \"unsorted\": false\n" + " },\n" + - " \"page_number\": 2,\n" + - " \"page_size\": 25,\n" + + " \"pageNumber\": 2,\n" + + " \"pageSize\": 25,\n" + " \"paged\": true,\n" + " \"unpaged\": false\n" + " },\n" + diff --git a/resource-server/src/test/java/com/inhabas/api/web/MenuControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/MenuControllerTest.java index f1478c23..86ee5c3d 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/MenuControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/MenuControllerTest.java @@ -40,7 +40,7 @@ public void getTotalMenuInfoTest() throws Exception { mvc.perform(get("/menus")) .andDo(print()) .andExpect(status().isOk()) - .andExpect(content().string("[{\"id\":1,\"group_name\":\"IBAS\",\"menu_list\":[{\"menu_id\":6,\"priority\":1,\"name\":\"ë\u008F\u0099ì\u0095\u0084리 ì\u0086\u008Cê°\u009C\",\"type\":\"INTRODUCE\",\"description\":\"\"}]}]")) + .andExpect(content().string("[{\"id\":1,\"groupName\":\"IBAS\",\"menuList\":[{\"menuId\":6,\"priority\":1,\"name\":\"ë\u008F\u0099ì\u0095\u0084리 ì\u0086\u008Cê°\u009C\",\"type\":\"INTRODUCE\",\"description\":\"\"}]}]")) .andReturn(); then(menuService).should(times(1)).getAllMenuInfo(); @@ -54,7 +54,7 @@ public void getMenuInfoByIdTest() throws Exception { new MenuDto(new MenuId(6),1,"공지사항", MenuType.LIST, "")); mvc.perform(get("/menu/6")) - .andExpect(content().string("{\"menu_id\":6,\"priority\":1,\"name\":\"ê³µì§\u0080ì\u0082¬í\u0095\u00AD\",\"type\":\"LIST\",\"description\":\"\"}")) + .andExpect(content().string("{\"menuId\":6,\"priority\":1,\"name\":\"ê³µì§\u0080ì\u0082¬í\u0095\u00AD\",\"type\":\"LIST\",\"description\":\"\"}")) .andExpect(status().isOk()) .andReturn(); diff --git a/resource-server/src/test/java/com/inhabas/api/web/configTest/WebConfigTest.java b/resource-server/src/test/java/com/inhabas/api/web/configTest/WebConfigTest.java index 3a17f821..207aadf6 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/configTest/WebConfigTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/configTest/WebConfigTest.java @@ -19,7 +19,7 @@ public class WebConfigTest { @Autowired private ModelResolver modelResolver; - @DisplayName("swagger 명세로 변환하는 modelResolver 는 snake_case 를 따른다.") + @DisplayName("swagger 명세로 변환하는 modelResolver 는 LOWER_CAMEL_CASE 를 따른다.") @Test public void ModelResolverSnakeCaseTest() { //when @@ -28,6 +28,6 @@ public void ModelResolverSnakeCaseTest() { //then Assertions.assertThat(propertyNamingStrategy) - .isEqualTo(PropertyNamingStrategies.SNAKE_CASE); + .isEqualTo(PropertyNamingStrategies.LOWER_CAMEL_CASE); } } diff --git a/resource-server/src/test/resources/application.yml b/resource-server/src/test/resources/application.yml index 0fa0cd46..f32cf6a1 100644 --- a/resource-server/src/test/resources/application.yml +++ b/resource-server/src/test/resources/application.yml @@ -16,7 +16,7 @@ spring: ansi: enabled: always jackson: - property-naming-strategy: SNAKE_CASE + property-naming-strategy: LOWER_CAMEL_CASE data: web: pageable: