11package com .somemore .volunteerapply .controller ;
22
33import static org .mockito .ArgumentMatchers .any ;
4- import static org .mockito .BDDMockito .given ;
54import static org .mockito .BDDMockito .willDoNothing ;
65import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .patch ;
76import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
87import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
98
10- import com .fasterxml .jackson .databind .ObjectMapper ;
119import com .somemore .ControllerTestSupport ;
1210import com .somemore .WithMockCustomUser ;
1311import com .somemore .volunteerapply .usecase .ApproveVolunteerApplyUseCase ;
12+ import com .somemore .volunteerapply .usecase .RejectVolunteerApplyUseCase ;
1413import java .util .UUID ;
1514import org .junit .jupiter .api .DisplayName ;
1615import org .junit .jupiter .api .Test ;
@@ -23,12 +22,12 @@ class CenterVolunteerApplyCommandApiControllerTest extends ControllerTestSupport
2322 @ Autowired
2423 private MockMvc mockMvc ;
2524
26- @ Autowired
27- private ObjectMapper objectMapper ;
28-
2925 @ MockBean
3026 private ApproveVolunteerApplyUseCase approveVolunteerApplyUseCase ;
3127
28+ @ MockBean
29+ private RejectVolunteerApplyUseCase rejectVolunteerApplyUseCase ;
30+
3231 @ Test
3332 @ DisplayName ("봉사 활동 지원 승인 성공 테스트" )
3433 @ WithMockCustomUser (role = "CENTER" )
@@ -47,4 +46,23 @@ void approve() throws Exception {
4746 .andExpect (jsonPath ("$.data" ).value ("" ))
4847 .andExpect (jsonPath ("$.message" ).value ("봉사 활동 지원 승인 성공" ));
4948 }
49+
50+ @ Test
51+ @ DisplayName ("봉사 활동 지원 거절 성공 테스트" )
52+ @ WithMockCustomUser (role = "CENTER" )
53+ void reject () throws Exception {
54+ // given
55+ Long id = 1L ;
56+
57+ willDoNothing ().given (rejectVolunteerApplyUseCase )
58+ .reject (any (), any (UUID .class ));
59+ // when
60+ mockMvc .perform (patch ("/api/volunteer-apply/{id}/reject" , id )
61+ .header ("Authorization" , "Bearer access-token" ))
62+ // then
63+ .andExpect (status ().isOk ())
64+ .andExpect (jsonPath ("$.code" ).value (200 ))
65+ .andExpect (jsonPath ("$.data" ).value ("" ))
66+ .andExpect (jsonPath ("$.message" ).value ("봉사 활동 지원 거절 성공" ));
67+ }
5068}
0 commit comments