22
33import com .somemore .domains .recruitboard .domain .RecruitBoard ;
44import com .somemore .domains .recruitboard .repository .RecruitBoardRepository ;
5+ import com .somemore .domains .review .domain .Review ;
6+ import com .somemore .domains .review .repository .ReviewRepository ;
57import com .somemore .domains .volunteer .domain .Volunteer ;
68import com .somemore .domains .volunteer .domain .VolunteerDetail ;
79import com .somemore .domains .volunteer .dto .request .VolunteerRegisterRequestDto ;
1113import com .somemore .domains .volunteerapply .dto .condition .VolunteerApplySearchCondition ;
1214import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyRecruitInfoResponseDto ;
1315import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyVolunteerInfoResponseDto ;
16+ import com .somemore .domains .volunteerapply .dto .response .VolunteerApplyWithReviewStatusResponseDto ;
1417import com .somemore .domains .volunteerapply .repository .VolunteerApplyRepository ;
1518import com .somemore .support .IntegrationTestSupport ;
1619import org .junit .jupiter .api .DisplayName ;
@@ -42,7 +45,30 @@ class VolunteerApplyQueryFacadeServiceTest extends IntegrationTestSupport {
4245 private VolunteerDetailRepository volunteerDetailRepository ;
4346 @ Autowired
4447 private VolunteerApplyRepository volunteerApplyRepository ;
48+ @ Autowired
49+ private ReviewRepository reviewRepository ;
50+
51+ @ DisplayName ("모집글 아이디와 봉사자 아이디로 지원 응답 값을 조회할 수 있다." )
52+ @ Test
53+ void getVolunteerApplyByRecruitIdAndVolunteerId () {
54+ // given
55+ Long recruitBoardId = 1234L ;
56+ UUID volunteerId = UUID .randomUUID ();
57+ VolunteerApply apply = createApply (volunteerId , recruitBoardId );
58+ volunteerApplyRepository .save (apply );
59+
60+ Review review = createReview (apply .getId (), volunteerId );
61+ reviewRepository .save (review );
62+
63+ // when
64+ VolunteerApplyWithReviewStatusResponseDto dto = volunteerApplyQueryFacadeService .getVolunteerApplyByRecruitIdAndVolunteerId (
65+ recruitBoardId , volunteerId );
4566
67+ // then
68+ assertThat (dto .recruitBoardId ()).isEqualTo (recruitBoardId );
69+ assertThat (dto .volunteerId ()).isEqualTo (volunteerId );
70+ assertThat (dto .isReviewed ()).isTrue ();
71+ }
4672
4773 @ DisplayName ("모집글 아이디와 기관 아이디로 필터에 맞는 지원자 간단 정보를 조회할 수 있다." )
4874 @ Test
@@ -108,6 +134,16 @@ void getVolunteerAppliesByVolunteerId() {
108134 assertThat (result ).hasSize (3 );
109135 }
110136
137+ private static Review createReview (Long volunteerApplyId , UUID volunteerId ) {
138+ return Review .builder ()
139+ .volunteerApplyId (volunteerApplyId )
140+ .volunteerId (volunteerId )
141+ .title ("리뷰 제목" )
142+ .content ("리뷰 내용" )
143+ .imgUrl ("리뷰 이미지" )
144+ .build ();
145+ }
146+
111147 private static VolunteerDetail createVolunteerDetail (UUID volunteerId ) {
112148
113149 VolunteerRegisterRequestDto volunteerRegisterRequestDto =
@@ -130,7 +166,7 @@ private static VolunteerApply createApply(UUID volunteerId, Long recruitId) {
130166 .volunteerId (volunteerId )
131167 .recruitBoardId (recruitId )
132168 .status (APPROVED )
133- .attended (false )
169+ .attended (true )
134170 .build ();
135171 }
136172
0 commit comments