From 5458440a717194333d00203b9284aefde7bdebe6 Mon Sep 17 00:00:00 2001 From: waterfog9580 Date: Tue, 9 Aug 2022 18:36:40 +0900 Subject: [PATCH] =?UTF-8?q?[BM-289]=20:white=5Fcheck=5Fmark:=20offset,=20l?= =?UTF-8?q?imit=20=EC=8B=A4=ED=8C=A8=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ChatRoomApiControllerTest.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/test/java/com/saiko/bidmarket/chat/controller/ChatRoomApiControllerTest.java b/src/test/java/com/saiko/bidmarket/chat/controller/ChatRoomApiControllerTest.java index d61529d7..378f4ad6 100644 --- a/src/test/java/com/saiko/bidmarket/chat/controller/ChatRoomApiControllerTest.java +++ b/src/test/java/com/saiko/bidmarket/chat/controller/ChatRoomApiControllerTest.java @@ -133,6 +133,25 @@ void ItResponse404(long offset) throws Exception { } } + @Nested + @DisplayName("offset 이 숫자가 아닐 경우") + class ContextWithNonNumberOffset { + + @Test + @DisplayName("404를 응답한다") + void ItResponse404() throws Exception { + MockHttpServletRequestBuilder request = RestDocumentationRequestBuilders + .get(REQUEST_URI) + .queryParam("offset", "test") + .queryParam("limit", "1"); + + ResultActions response = mockMvc.perform(request); + + //then + response.andExpect(status().isBadRequest()); + } + } + @Nested @DisplayName("limit 양수가 아닐 경우") class ContextWithNonPositiveLimit { @@ -154,6 +173,24 @@ void ItResponse404(int limit) throws Exception { } } + @Nested + @DisplayName("limit 이 숫자가 아닐 경우") + class ContextWithNonNumberLimit { + + @Test + @DisplayName("404를 응답한다") + void ItResponse404() throws Exception { + MockHttpServletRequestBuilder request = RestDocumentationRequestBuilders + .get(REQUEST_URI) + .queryParam("offset", "1") + .queryParam("limit", "test"); + + ResultActions response = mockMvc.perform(request); + + //then + response.andExpect(status().isBadRequest()); + } + } } private User getUser(long userId) {