22
33import com .somemore .domains .volunteerapply .dto .condition .VolunteerApplySearchCondition ;
44import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyRecruitInfoResponseDto ;
5- import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyWithReviewStatusResponseDto ;
65import com .somemore .domains .volunteerapply .dto .response .VolunteerApplySummaryResponseDto ;
76import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyVolunteerInfoResponseDto ;
7+ import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyWithReviewStatusResponseDto ;
88import com .somemore .domains .volunteerapply .usecase .VolunteerApplyQueryFacadeUseCase ;
99import com .somemore .domains .volunteerapply .usecase .VolunteerApplyQueryUseCase ;
1010import com .somemore .global .exception .NoSuchElementException ;
1111import com .somemore .support .ControllerTestSupport ;
12+ import com .somemore .support .annotation .MockUser ;
1213import com .somemore .support .annotation .WithMockCustomUser ;
1314import org .junit .jupiter .api .DisplayName ;
1415import org .junit .jupiter .api .Test ;
@@ -37,12 +38,13 @@ class VolunteerApplyQueryApiControllerTest extends ControllerTestSupport {
3738 private VolunteerApplyQueryFacadeUseCase volunteerApplyQueryFacadeUseCase ;
3839
3940
40- @ DisplayName ("특정 모집글 봉사자 지원 단건 조회 성공 테스트" )
41+ @ MockUser
42+ @ DisplayName ("특정 모집글 봉사 지원 단건 조회 성공 테스트" )
4143 @ Test
42- void getVolunteerApplyByRecruitIdAndVolunteerId () throws Exception {
44+ void getVolunteerApplyByRecruitBoardId () throws Exception {
4345 // given
4446 Long recruitBoardId = 1L ;
45- UUID volunteerId = UUID .randomUUID ( );
47+ UUID volunteerId = UUID .fromString ( "123e4567-e89b-12d3-a456-426614174000" );
4648
4749 VolunteerApplyWithReviewStatusResponseDto response = VolunteerApplyWithReviewStatusResponseDto .builder ()
4850 .id (1L )
@@ -52,40 +54,36 @@ void getVolunteerApplyByRecruitIdAndVolunteerId() throws Exception {
5254 .attended (false )
5355 .build ();
5456
55- given (volunteerApplyQueryFacadeUseCase .getVolunteerApplyByRecruitIdAndVolunteerId (recruitBoardId ,
56- volunteerId ))
57+ given (volunteerApplyQueryFacadeUseCase .getVolunteerApplyByRecruitIdAndVolunteerId (recruitBoardId , volunteerId ))
5758 .willReturn (response );
5859
5960 // when & then
60- mockMvc .perform (
61- get ("/api/volunteer-apply/recruit-board/{recruitBoardId}/volunteer/{volunteerId}" ,
62- recruitBoardId , volunteerId )
63- .accept (APPLICATION_JSON ))
61+ mockMvc .perform (get ("/api/volunteer-apply/recruit-board/{recruitBoardId}" , recruitBoardId )
62+ .accept (APPLICATION_JSON ))
6463 .andExpect (status ().isOk ())
6564 .andExpect (jsonPath ("$.code" ).value (200 ))
66- .andExpect (jsonPath ("$.message" ).value ("특정 모집글에 대한 봉사자 지원 단건 조회 성공" ))
65+ .andExpect (jsonPath ("$.message" ).value ("특정 모집글에 대한 봉사 지원 단건 조회 성공" ))
6766 .andExpect (jsonPath ("$.data.id" ).value (1 ))
6867 .andExpect (jsonPath ("$.data.volunteer_id" ).value (volunteerId .toString ()))
6968 .andExpect (jsonPath ("$.data.recruit_board_id" ).value (recruitBoardId ))
7069 .andExpect (jsonPath ("$.data.status" ).value ("WAITING" ))
7170 .andExpect (jsonPath ("$.data.attended" ).value (false ));
7271 }
7372
73+ @ MockUser
7474 @ DisplayName ("특정 모집글 봉사자 지원 단건 조회 성공 테스트 - 지원 내역이 없는 경우" )
7575 @ Test
76- void getVolunteerApplyByRecruitIdAndVolunteerIdWhenDoesNotExist () throws Exception {
76+ void getVolunteerApplyByRecruitBoardIdWhenDoesNotExist () throws Exception {
7777 // given
7878 Long recruitBoardId = 1L ;
79- UUID volunteerId = UUID .randomUUID ( );
79+ UUID volunteerId = UUID .fromString ( "123e4567-e89b-12d3-a456-426614174000" );
8080
81- given (volunteerApplyQueryFacadeUseCase .getVolunteerApplyByRecruitIdAndVolunteerId (recruitBoardId ,
82- volunteerId ))
81+ given (volunteerApplyQueryFacadeUseCase .getVolunteerApplyByRecruitIdAndVolunteerId (recruitBoardId , volunteerId ))
8382 .willThrow (new NoSuchElementException (NOT_EXISTS_VOLUNTEER_APPLY ));
8483
8584 // when & then
8685 mockMvc .perform (
87- get ("/api/volunteer-apply/recruit-board/{recruitBoardId}/volunteer/{volunteerId}" ,
88- recruitBoardId , volunteerId )
86+ get ("/api/volunteer-apply/recruit-board/{recruitBoardId}" , recruitBoardId )
8987 .accept (APPLICATION_JSON ))
9088 .andExpect (status ().isOk ())
9189 .andExpect (jsonPath ("$.code" ).value (210 ))
0 commit comments