From 8057a90a49f69eb77ade033396172aeeb11969b7 Mon Sep 17 00:00:00 2001 From: 3juhwan <13selfesteem91@naver.com> Date: Mon, 5 Aug 2024 00:17:42 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=9A=94=EC=B2=AD=20url=EC=97=90?= =?UTF-8?q?=20token=EC=9D=84=20eventId=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ActionControllerTest.java | 2 +- .../BillActionControllerTest.java | 20 +++++++++---------- .../presentation/EventControllerTest.java | 12 +++++------ .../MemberActionControllerTest.java | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/server/src/test/java/server/haengdong/presentation/ActionControllerTest.java b/server/src/test/java/server/haengdong/presentation/ActionControllerTest.java index 739ac4962..ce1345917 100644 --- a/server/src/test/java/server/haengdong/presentation/ActionControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/ActionControllerTest.java @@ -36,7 +36,7 @@ void getMemberBillReports() throws Exception { given(actionService.getMemberBillReports(any())).willReturn(memberBillReportAppResponses); - mockMvc.perform(get("/api/events/{token}/actions/reports", "token") + mockMvc.perform(get("/api/events/{eventId}/actions/reports", "망쵸토큰") .accept(MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()) diff --git a/server/src/test/java/server/haengdong/presentation/BillActionControllerTest.java b/server/src/test/java/server/haengdong/presentation/BillActionControllerTest.java index 5b12599d0..901e31b6d 100644 --- a/server/src/test/java/server/haengdong/presentation/BillActionControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/BillActionControllerTest.java @@ -46,9 +46,9 @@ void saveAllBillAction() throws Exception { ) ); String requestBody = objectMapper.writeValueAsString(request); - String token = "TOKEN"; + String eventId = "쿠키토큰"; - mockMvc.perform(post("/api/events/{token}/bill-actions", token) + mockMvc.perform(post("/api/events/{eventId}/bill-actions", eventId) .contentType(MediaType.APPLICATION_JSON) .content(requestBody)) .andDo(print()) @@ -65,9 +65,9 @@ void saveAllBillAction1() throws Exception { ) ); String requestBody = objectMapper.writeValueAsString(request); - String token = "TOKEN"; + String eventId = "소하토큰"; - mockMvc.perform(post("/api/events/{token}/bill-actions", token) + mockMvc.perform(post("/api/events/{eventId}/bill-actions", eventId) .contentType(MediaType.APPLICATION_JSON) .content(requestBody)) .andDo(print()) @@ -80,9 +80,9 @@ void updateBillAction() throws Exception { BillActionUpdateRequest request = new BillActionUpdateRequest("뽕족", 10_000L); String requestBody = objectMapper.writeValueAsString(request); - String token = "TOKEN"; + String eventId = "웨디토큰"; - mockMvc.perform(put("/api/events/{token}/bill-actions/{actionId}", token, 1L) + mockMvc.perform(put("/api/events/{eventId}/bill-actions/{actionId}", eventId, 1L) .contentType(MediaType.APPLICATION_JSON) .content(requestBody)) .andDo(print()) @@ -92,9 +92,9 @@ void updateBillAction() throws Exception { @DisplayName("지출 내역을 삭제한다.") @Test void deleteBillAction() throws Exception { - String token = "토다리토큰"; + String eventId = "토다리토큰"; - mockMvc.perform(delete("/api/events/{token}/bill-actions/{actionId}", token, 1)) + mockMvc.perform(delete("/api/events/{eventId}/bill-actions/{actionId}", eventId, 1)) .andDo(print()) .andExpect(status().isOk()); } @@ -102,11 +102,11 @@ void deleteBillAction() throws Exception { @DisplayName("존재하지 않는 행사에 대한 지출 내역을 삭제할 수 없다.") @Test void deleteBillAction1() throws Exception { - String token = "TOKEN19348"; + String eventId = "이상해토큰"; doThrow(new HaengdongException(HaengdongErrorCode.NOT_FOUND_EVENT)) .when(billActionService).deleteBillAction(any(String.class), any(Long.class)); - mockMvc.perform(delete("/api/events/{token}/bill-actions/{actionId}", token, 1)) + mockMvc.perform(delete("/api/events/{eventId}/bill-actions/{actionId}", eventId, 1)) .andDo(print()) .andExpect(status().isBadRequest()); } diff --git a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java b/server/src/test/java/server/haengdong/presentation/EventControllerTest.java index 55a48630f..0b8527952 100644 --- a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/EventControllerTest.java @@ -39,8 +39,8 @@ class EventControllerTest { void saveEvent() throws Exception { EventSaveRequest eventSaveRequest = new EventSaveRequest("토다리"); String requestBody = objectMapper.writeValueAsString(eventSaveRequest); - String token = "TOKEN"; - EventAppResponse eventAppResponse = new EventAppResponse(token); + String eventId = "망쵸토큰"; + EventAppResponse eventAppResponse = new EventAppResponse(eventId); given(eventService.saveEvent(any(EventAppRequest.class))).willReturn(eventAppResponse); mockMvc.perform(post("/api/events") @@ -48,17 +48,17 @@ void saveEvent() throws Exception { .content(requestBody)) .andDo(print()) .andExpect(status().isOk()) - .andExpect(jsonPath("$.eventId").value("TOKEN")); + .andExpect(jsonPath("$.eventId").value("망쵸토큰")); } @DisplayName("토큰으로 행사를 조회한다.") @Test void findEventTest() throws Exception { - String token = "TOKEN"; + String eventId = "망쵸토큰"; EventDetailAppResponse eventDetailAppResponse = new EventDetailAppResponse("행동대장 회식"); - given(eventService.findEvent(token)).willReturn(eventDetailAppResponse); + given(eventService.findEvent(eventId)).willReturn(eventDetailAppResponse); - mockMvc.perform(get("/api/events/" + token)) + mockMvc.perform(get("/api/events/{eventId}", eventId)) .andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.eventName").value("행동대장 회식")); diff --git a/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java b/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java index 0c59cb172..a195311d1 100644 --- a/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java @@ -43,7 +43,7 @@ void saveMemberActionTest() throws Exception { String requestBody = objectMapper.writeValueAsString(memberActionsSaveRequest); - mockMvc.perform(post("/api/events/TOKEN/member-actions") + mockMvc.perform(post("/api/events/{eventId}/member-actions", "망쵸토큰") .contentType(MediaType.APPLICATION_JSON) .content(requestBody)) .andDo(print()) @@ -58,7 +58,7 @@ void getCurrentMembers() throws Exception { given(memberActionService.getCurrentMembers(any())).willReturn(currentMemberAppResponses); - mockMvc.perform(get("/api/events/{token}/members/current", "token") + mockMvc.perform(get("/api/events/{eventId}/members/current", "망쵸토큰") .accept(MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()) @@ -69,10 +69,10 @@ void getCurrentMembers() throws Exception { @DisplayName("이벤트에 속한 멤버 액션을 삭제하면 이후에 기록된 해당 참여자의 모든 멤버 액션을 삭제한다.") @Test void deleteMemberAction() throws Exception { - String token = "TOKEN"; + String eventId = "망쵸토큰"; Long actionId = 2L; - mockMvc.perform(delete("/api/events/{token}/member-actions/{actionId}", token, actionId)) + mockMvc.perform(delete("/api/events/{eventId}/member-actions/{actionId}", eventId, actionId)) .andDo(print()) .andExpect(status().isOk()); } @@ -80,7 +80,7 @@ void deleteMemberAction() throws Exception { @DisplayName("행사의 전체 참여자 중에서 특정 참여자의 맴버 액션을 전부 삭제한다.") @Test void deleteMember() throws Exception { - String eventId = "TOKEN"; + String eventId = "망쵸토큰"; String memberName = "행동대장"; mockMvc.perform(delete("/api/events/{eventId}/members/{memberName}", eventId, memberName))