Skip to content

Commit d8d609b

Browse files
committed
test(volunteer-apply): 봉사 활동 지원 거절 API 테스트
1 parent cc75f9a commit d8d609b

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/test/java/com/somemore/volunteerapply/controller/CenterVolunteerApplyCommandApiControllerTest.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package com.somemore.volunteerapply.controller;
22

33
import static org.mockito.ArgumentMatchers.any;
4-
import static org.mockito.BDDMockito.given;
54
import static org.mockito.BDDMockito.willDoNothing;
65
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
76
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
87
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
98

10-
import com.fasterxml.jackson.databind.ObjectMapper;
119
import com.somemore.ControllerTestSupport;
1210
import com.somemore.WithMockCustomUser;
1311
import com.somemore.volunteerapply.usecase.ApproveVolunteerApplyUseCase;
12+
import com.somemore.volunteerapply.usecase.RejectVolunteerApplyUseCase;
1413
import java.util.UUID;
1514
import org.junit.jupiter.api.DisplayName;
1615
import 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

Comments
 (0)