From e542c22f405aa539d7b9790c4e8d3de4f37f8ffd Mon Sep 17 00:00:00 2001 From: kyeong-hyeok Date: Sat, 14 Dec 2024 23:34:43 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EA=B3=B5=EA=B3=A0=20=EB=81=8C=EC=96=B4?= =?UTF-8?q?=EC=98=AC=EB=A6=AC=EA=B8=B0=20Controller=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../post/controller/PostControllerTest.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/pawwithu/connectdog/domain/post/controller/PostControllerTest.java b/src/test/java/com/pawwithu/connectdog/domain/post/controller/PostControllerTest.java index a8e08ebd..74dd208a 100644 --- a/src/test/java/com/pawwithu/connectdog/domain/post/controller/PostControllerTest.java +++ b/src/test/java/com/pawwithu/connectdog/domain/post/controller/PostControllerTest.java @@ -1,7 +1,6 @@ package com.pawwithu.connectdog.domain.post.controller; import com.fasterxml.jackson.databind.ObjectMapper; -import com.pawwithu.connectdog.domain.dog.entity.DogGender; import com.pawwithu.connectdog.domain.dog.entity.DogSize; import com.pawwithu.connectdog.domain.post.dto.response.*; import com.pawwithu.connectdog.domain.post.entity.PostStatus; @@ -16,6 +15,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; +import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -29,8 +29,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @ExtendWith(MockitoExtension.class) @@ -226,4 +225,20 @@ void setUp() { get("/volunteers/posts/{postId}", postId) ); } + + @Test + void 이동봉사_공고_끌어올리기() throws Exception { + //given + Long postId = 1L; + + //when + ResultActions result = mockMvc.perform( + patch("/intermediaries/posts/{postId}/boost", postId) + .contentType(MediaType.APPLICATION_JSON) + ); + + //then + result.andExpect(status().isNoContent()); + verify(postService, times(1)).boostPost(anyString(), anyLong()); + } } \ No newline at end of file