11package com .somemore .domains .volunteerapply .service ;
22
3+ import static com .somemore .domains .recruitboard .domain .VolunteerCategory .COUNSELING ;
4+ import static com .somemore .domains .volunteerapply .domain .ApplyStatus .APPROVED ;
5+ import static com .somemore .global .exception .ExceptionMessage .RECRUIT_BOARD_ID_MISMATCH ;
6+ import static com .somemore .global .exception .ExceptionMessage .UNAUTHORIZED_RECRUIT_BOARD ;
7+ import static com .somemore .global .exception .ExceptionMessage .VOLUNTEER_APPLY_LIST_MISMATCH ;
8+ import static com .somemore .support .fixture .RecruitBoardFixture .createCompletedRecruitBoard ;
9+ import static org .assertj .core .api .Assertions .assertThat ;
10+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
11+
312import com .somemore .domains .recruitboard .domain .RecruitBoard ;
413import com .somemore .domains .recruitboard .repository .RecruitBoardRepository ;
5- import com .somemore .domains .volunteer .domain .Volunteer ;
6- import com .somemore .domains .volunteer .repository .VolunteerRepository ;
714import com .somemore .domains .volunteerapply .domain .VolunteerApply ;
815import com .somemore .domains .volunteerapply .dto .request .VolunteerApplySettleRequestDto ;
916import com .somemore .domains .volunteerapply .repository .VolunteerApplyRepository ;
1017import com .somemore .global .exception .BadRequestException ;
1118import com .somemore .support .IntegrationTestSupport ;
19+ import com .somemore .volunteer .domain .NEWVolunteer ;
20+ import com .somemore .volunteer .repository .NEWVolunteerRepository ;
21+ import java .util .List ;
22+ import java .util .UUID ;
1223import org .junit .jupiter .api .DisplayName ;
1324import org .junit .jupiter .api .Test ;
1425import org .springframework .beans .factory .annotation .Autowired ;
1526import org .springframework .transaction .annotation .Transactional ;
1627
17- import java .util .List ;
18- import java .util .UUID ;
19-
20- import static com .somemore .domains .recruitboard .domain .VolunteerCategory .COUNSELING ;
21- import static com .somemore .domains .volunteerapply .domain .ApplyStatus .APPROVED ;
22- import static com .somemore .global .auth .oauth .domain .OAuthProvider .NAVER ;
23- import static com .somemore .global .exception .ExceptionMessage .*;
24- import static com .somemore .support .fixture .RecruitBoardFixture .createCompletedRecruitBoard ;
25- import static org .assertj .core .api .Assertions .assertThat ;
26- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
27-
2828@ Transactional
2929class SettleVolunteerApplyFacadeServiceTest extends IntegrationTestSupport {
3030
@@ -38,17 +38,17 @@ class SettleVolunteerApplyFacadeServiceTest extends IntegrationTestSupport {
3838 private VolunteerApplyRepository volunteerApplyRepository ;
3939
4040 @ Autowired
41- private VolunteerRepository volunteerRepository ;
41+ private NEWVolunteerRepository volunteerRepository ;
4242
4343 @ DisplayName ("봉사 활동 지원을 정산할 수 있다." )
4444 @ Test
4545 void settleVolunteerApplies () {
4646 // given
4747 UUID centerId = UUID .randomUUID ();
4848
49- Volunteer volunteer1 = volunteerRepository .save (createVolunteer ());
50- Volunteer volunteer2 = volunteerRepository .save (createVolunteer ());
51- Volunteer volunteer3 = volunteerRepository .save (createVolunteer ());
49+ NEWVolunteer volunteer1 = volunteerRepository .save (createVolunteer ());
50+ NEWVolunteer volunteer2 = volunteerRepository .save (createVolunteer ());
51+ NEWVolunteer volunteer3 = volunteerRepository .save (createVolunteer ());
5252
5353 RecruitBoard board = createCompletedRecruitBoard (centerId , COUNSELING );
5454 recruitBoardRepository .save (board );
@@ -75,9 +75,12 @@ void settleVolunteerApplies() {
7575 assertThat (findApply2 .getAttended ()).isTrue ();
7676 assertThat (findApply3 .getAttended ()).isTrue ();
7777
78- Volunteer findVolunteer1 = volunteerRepository .findById (volunteer1 .getId ()).orElseThrow ();
79- Volunteer findVolunteer2 = volunteerRepository .findById (volunteer2 .getId ()).orElseThrow ();
80- Volunteer findVolunteer3 = volunteerRepository .findById (volunteer3 .getId ()).orElseThrow ();
78+ NEWVolunteer findVolunteer1 = volunteerRepository .findById (volunteer1 .getId ())
79+ .orElseThrow ();
80+ NEWVolunteer findVolunteer2 = volunteerRepository .findById (volunteer2 .getId ())
81+ .orElseThrow ();
82+ NEWVolunteer findVolunteer3 = volunteerRepository .findById (volunteer3 .getId ())
83+ .orElseThrow ();
8184
8285 assertThat (findVolunteer1 .getTotalVolunteerHours ()).isEqualTo (hour );
8386 assertThat (findVolunteer2 .getTotalVolunteerHours ()).isEqualTo (hour );
@@ -94,7 +97,7 @@ void settleVolunteerAppliesWhenNotExistId() {
9497 // given
9598 UUID centerId = UUID .randomUUID ();
9699
97- Volunteer volunteer = volunteerRepository .save (createVolunteer ());
100+ NEWVolunteer volunteer = volunteerRepository .save (createVolunteer ());
98101
99102 RecruitBoard board = createCompletedRecruitBoard (centerId , COUNSELING );
100103 recruitBoardRepository .save (board );
@@ -109,8 +112,8 @@ void settleVolunteerAppliesWhenNotExistId() {
109112 // when
110113 // then
111114 assertThatThrownBy (
112- () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , centerId )
113- ) .isInstanceOf (BadRequestException .class )
115+ () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , centerId ))
116+ .isInstanceOf (BadRequestException .class )
114117 .hasMessage (VOLUNTEER_APPLY_LIST_MISMATCH .getMessage ());
115118
116119 }
@@ -121,8 +124,8 @@ void settleVolunteerAppliesWhenMismatchApplyAndRecruitBoard() {
121124 // given
122125 UUID centerId = UUID .randomUUID ();
123126
124- Volunteer volunteer1 = volunteerRepository .save (createVolunteer ());
125- Volunteer volunteer2 = volunteerRepository .save (createVolunteer ());
127+ NEWVolunteer volunteer1 = volunteerRepository .save (createVolunteer ());
128+ NEWVolunteer volunteer2 = volunteerRepository .save (createVolunteer ());
126129
127130 RecruitBoard board = createCompletedRecruitBoard (centerId , COUNSELING );
128131 recruitBoardRepository .save (board );
@@ -138,8 +141,8 @@ void settleVolunteerAppliesWhenMismatchApplyAndRecruitBoard() {
138141 // when
139142 // then
140143 assertThatThrownBy (
141- () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , centerId )
142- ) .isInstanceOf (BadRequestException .class )
144+ () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , centerId ))
145+ .isInstanceOf (BadRequestException .class )
143146 .hasMessage (RECRUIT_BOARD_ID_MISMATCH .getMessage ());
144147 }
145148
@@ -149,8 +152,8 @@ void settleVolunteerAppliesWhenNoAuthCenter() {
149152 // given
150153 UUID wrongId = UUID .randomUUID ();
151154
152- Volunteer volunteer1 = volunteerRepository .save (createVolunteer ());
153- Volunteer volunteer2 = volunteerRepository .save (createVolunteer ());
155+ NEWVolunteer volunteer1 = volunteerRepository .save (createVolunteer ());
156+ NEWVolunteer volunteer2 = volunteerRepository .save (createVolunteer ());
154157
155158 RecruitBoard board = createCompletedRecruitBoard (UUID .randomUUID (), COUNSELING );
156159 recruitBoardRepository .save (board );
@@ -166,13 +169,13 @@ void settleVolunteerAppliesWhenNoAuthCenter() {
166169 // when
167170 // then
168171 assertThatThrownBy (
169- () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , wrongId )
170- ) .isInstanceOf (BadRequestException .class )
172+ () -> settleVolunteerApplyFacadeService .settleVolunteerApplies (dto , wrongId ))
173+ .isInstanceOf (BadRequestException .class )
171174 .hasMessage (UNAUTHORIZED_RECRUIT_BOARD .getMessage ());
172175 }
173176
174- private static Volunteer createVolunteer () {
175- return Volunteer .createDefault (NAVER , "naver" );
177+ private static NEWVolunteer createVolunteer () {
178+ return NEWVolunteer .createDefault (UUID . randomUUID () );
176179 }
177180
178181 private static VolunteerApply createApply (UUID volunteerId , Long recruitId ) {
0 commit comments