From da87a203a98e449a72c127e940631af7fcec4da0 Mon Sep 17 00:00:00 2001 From: k000927 Date: Wed, 31 Jul 2024 15:18:18 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=ED=85=8D=EC=8A=A4=ED=8A=B8=EB=B8=94=EB=A1=9D?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LotteryEventController.java | 1 - .../domain/health/api/HealthController.java | 2 - .../LotteryEventControllerTest.java | 72 +++++++++++-------- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java index ebb6d513..86e9d9fd 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java @@ -18,7 +18,6 @@ public class LotteryEventController { @PostMapping public ResponseEntity> postCasperBot(@CookieValue String userData, @RequestBody String body) { - return new ResponseEntity<>(CustomResponse.create(lotteryEventService.postCasperBot(userData, body)), HttpStatus.CREATED); } } diff --git a/Server/src/main/java/JGS/CasperEvent/domain/health/api/HealthController.java b/Server/src/main/java/JGS/CasperEvent/domain/health/api/HealthController.java index 745ca347..6e6ed520 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/health/api/HealthController.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/health/api/HealthController.java @@ -7,8 +7,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static JGS.CasperEvent.global.response.CustomResponse.response; - @RestController @RequestMapping("/health") public class HealthController { diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java index 65dc4a2e..c48349f7 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java @@ -29,14 +29,16 @@ public class LotteryEventControllerTest { @DisplayName("캐스퍼 봇 생성 성공 테스트") void createCasperBotSuccessTest() throws Exception { //given - String casperBotRequest = "{\n" + - "\"eyeShape\": \"2\",\n" + - "\"eyePosition\": \"1\",\n" + - "\"mouthShape\": \"4\",\n" + - "\"color\": \"2\",\n" + - "\"sticker\": \"4\",\n" + - "\"name\": \"myCasperBot\",\n" + - "\"expectation\": \"myExpectation\"\n" + "}"; + String casperBotRequest = """ + { + "eyeShape": "2", + "eyePosition": "1", + "mouthShape": "4", + "color": "2", + "sticker": "4", + "name": "myCasperBot", + "expectation": "myExpectation" + }"""; Cookie myCookie = new Cookie("userData", "abc"); @@ -64,13 +66,16 @@ void createCasperBotSuccessTest() throws Exception { @DisplayName("캐스퍼 봇 생성 실패 테스트 - 필수 필드 없음") void createCasperBotFailureTest_RequiredFieldNotExist() throws Exception { //given - String casperBotRequest = "{" + - "\"eye_shape\": \"2\"," + - "\"eye_position\": \"1\"," + - "\"mouth_shape\": \"4\"," + - "\"color\": \"2\"," + - "\"sticker\": \"4\"," + - "\"expectation\": \"myExpectation\"" + "}"; + String casperBotRequest = """ + { + "eye_shape": "2", + "eye_position": "1", + "mouth_shape": "4", + "color": "2", + "sticker": "4", + "expectation": "myExpectation" + } + """; Cookie myCookie = new Cookie("userData", "abc"); @@ -90,14 +95,16 @@ void createCasperBotFailureTest_RequiredFieldNotExist() throws Exception { @DisplayName("캐스퍼 봇 생성 실패 테스트 - 잘못된 값") void createCasperBotSuccessTest_WrongValue() throws Exception { //given - String casperBotRequest = "{" + - "\"eyeShape\": \"15\"," + - "\"eyePosition\": \"1\"," + - "\"mouthShape\": \"4\"," + - "\"color\": \"2\"," + - "\"sticker\": \"4\"," + - "\"name\": \"myCasperBot\"," + - "\"expectation\": \"myExpectation\"" + "}"; + String casperBotRequest = """ + { + "eyeShape": "15", + "eyePosition": "1", + "mouthShape": "4", + "color": "2", + "sticker": "4", + "name": "myCasperBot", + "expectation": "myExpectation" + }"""; Cookie myCookie = new Cookie("userData", "abc"); //when @@ -116,14 +123,17 @@ void createCasperBotSuccessTest_WrongValue() throws Exception { @DisplayName("캐스퍼 봇 생성 실패 테스트 - 쿠키 없음") void createCasperBotSuccessTest_CookieNotPresent() throws Exception { //given - String casperBotRequest = "{" + - "\"eyeShape\": \"1\"," + - "\"eyePosition\": \"1\"," + - "\"mouthShape\": \"4\"," + - "\"color\": \"2\"," + - "\"sticker\": \"4\"," + - "\"name\": \"myCasperBot\"," + - "\"expectation\": \"myExpectation\"" + "}"; + String casperBotRequest = """ + { + "eyeShape": "1", + "eyePosition": "1", + "mouthShape": "4", + "color": "2", + "sticker": "4", + "name": "myCasperBot", + "expectation": "myExpectation" + } + """; //when ResultActions perform = mockMvc.perform(post("/event/lottery")