Skip to content

Commit ba34fad

Browse files
committed
test(volunteer-apply): 특정 봉사 지원 리스트 조회 기능 API 테스트
1 parent 49c7198 commit ba34fad

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import com.somemore.ControllerTestSupport;
1212
import com.somemore.WithMockCustomUser;
1313
import com.somemore.volunteerapply.dto.condition.VolunteerApplySearchCondition;
14-
import com.somemore.volunteerapply.dto.response.VolunteerApplyDetailResponseDto;
14+
import com.somemore.volunteerapply.dto.response.VolunteerApplyRecruitInfoResponseDto;
1515
import com.somemore.volunteerapply.dto.response.VolunteerApplyResponseDto;
1616
import com.somemore.volunteerapply.dto.response.VolunteerApplySummaryResponseDto;
17+
import com.somemore.volunteerapply.dto.response.VolunteerApplyVolunteerInfoResponseDto;
1718
import com.somemore.volunteerapply.usecase.VolunteerApplyQueryFacadeUseCase;
1819
import com.somemore.volunteerapply.usecase.VolunteerApplyQueryUseCase;
1920
import java.util.Collections;
@@ -105,15 +106,15 @@ void getSummaryByRecruitBoardId() throws Exception {
105106
void getVolunteerApplies() throws Exception {
106107
// given
107108
Long recruitBoardId = 1L;
108-
Page<VolunteerApplyDetailResponseDto> page = new PageImpl<>(Collections.emptyList());
109+
Page<VolunteerApplyVolunteerInfoResponseDto> page = new PageImpl<>(Collections.emptyList());
109110

110111
given(volunteerApplyQueryFacadeUseCase.getVolunteerAppliesByRecruitIdAndCenterId(
111112
any(), any(UUID.class), any(VolunteerApplySearchCondition.class)))
112113
.willReturn(page);
113114

114115
// when
115116
// then
116-
mockMvc.perform(get("/api/volunteer-applies//recruit-board/{id}", recruitBoardId)
117+
mockMvc.perform(get("/api/volunteer-applies/recruit-board/{id}", recruitBoardId)
117118
.param("attended", "false")
118119
.param("status", WAITING.toString())
119120
.accept(APPLICATION_JSON))
@@ -122,4 +123,27 @@ void getVolunteerApplies() throws Exception {
122123
.andExpect(jsonPath("$.data").exists())
123124
.andExpect(jsonPath("$.message").value("지원자 리스트 조회 성공"));
124125
}
126+
127+
@Test
128+
@DisplayName("특정 봉사자 지원 리스트를 조회 성공 테스트")
129+
void getVolunteerAppliesByVolunteerId() throws Exception {
130+
// given
131+
UUID volunteerId = UUID.randomUUID();
132+
Page<VolunteerApplyRecruitInfoResponseDto> page = new PageImpl<>(Collections.emptyList());
133+
134+
given(volunteerApplyQueryFacadeUseCase.getVolunteerAppliesByVolunteerId(
135+
any(UUID.class), any(VolunteerApplySearchCondition.class)))
136+
.willReturn(page);
137+
138+
// when
139+
// then
140+
mockMvc.perform(get("/api/volunteer-applies/volunteer/{id}", volunteerId.toString())
141+
.param("attended", "false")
142+
.param("status", WAITING.toString())
143+
.accept(APPLICATION_JSON))
144+
.andExpect(status().isOk())
145+
.andExpect(jsonPath("$.code").value(200))
146+
.andExpect(jsonPath("$.data").exists())
147+
.andExpect(jsonPath("$.message").value("봉사 지원 리스트 조회 성공"));
148+
}
125149
}

0 commit comments

Comments
 (0)