33import com .somemore .domains .volunteer .domain .Volunteer ;
44import com .somemore .domains .volunteer .domain .VolunteerDetail ;
55import com .somemore .domains .volunteer .dto .request .VolunteerRegisterRequestDto ;
6- import com .somemore .domains .volunteer .repository .VolunteerDetailRepository ;
76import com .somemore .domains .volunteer .repository .mapper .VolunteerOverviewForRankingByHours ;
87import com .somemore .domains .volunteer .repository .mapper .VolunteerSimpleInfo ;
98import com .somemore .support .IntegrationTestSupport ;
109import org .assertj .core .api .AssertionsForClassTypes ;
11- import org .junit .jupiter .api .BeforeEach ;
1210import org .junit .jupiter .api .DisplayName ;
1311import org .junit .jupiter .api .Test ;
1412import org .springframework .beans .factory .annotation .Autowired ;
@@ -30,20 +28,14 @@ class VolunteerRepositoryImplTest extends IntegrationTestSupport {
3028
3129 @ Autowired
3230 private VolunteerDetailRepository volunteerDetailRepository ;
33-
34- String oAuthId ;
35- Volunteer volunteer ;
36-
37- @ BeforeEach
38- void setup () {
39- oAuthId = "example-oauth-id" ;
40- volunteer = Volunteer .createDefault (NAVER , oAuthId );
41- volunteerRepository .save (volunteer );
42- }
43-
31+
4432 @ DisplayName ("봉사자의 id로 닉네임을 조회한다." )
4533 @ Test
4634 void findNicknameById () {
35+ String oAuthId = "example-oauth-id" ;
36+ Volunteer volunteer = Volunteer .createDefault (NAVER , oAuthId );
37+ volunteerRepository .save (volunteer );
38+
4739 // when
4840 String volunteerNickname = volunteerRepository .findNicknameById (volunteer .getId ());
4941
@@ -67,6 +59,11 @@ void findNicknameByInvalidId() {
6759 @ DisplayName ("봉사자의 id로 봉사자 정보를 조회한다." )
6860 @ Test
6961 void findById () {
62+
63+ String oAuthId = "example-oauth-id" ;
64+ Volunteer volunteer = Volunteer .createDefault (NAVER , oAuthId );
65+ volunteerRepository .save (volunteer );
66+
7067 // when
7168 Optional <Volunteer > foundVolunteer = volunteerRepository .findById (volunteer .getId ());
7269
@@ -79,13 +76,14 @@ void findById() {
7976 @ DisplayName ("OAuth ID로 봉사자 정보를 조회한다." )
8077 @ Test
8178 void findByOauthId () {
79+ String oAuthId = "example-oauth-id" ;
80+ Volunteer volunteer = Volunteer .createDefault (NAVER , oAuthId );
81+ volunteerRepository .save (volunteer );
8282 // when
8383 Optional <Volunteer > foundVolunteer = volunteerRepository .findByOauthId (oAuthId );
8484
8585 // then
8686 assertThat (foundVolunteer ).isPresent ();
87- assertThat (foundVolunteer .get ().getOauthId ()).isEqualTo (oAuthId );
88- assertThat (foundVolunteer .get ().getNickname ()).isEqualTo (volunteer .getNickname ());
8987 }
9088
9189 @ DisplayName ("봉사 시간 기준 상위 4명을 조회한다." )
@@ -211,9 +209,9 @@ void notExistsVolunteerById() {
211209 }
212210
213211 private void createVolunteerAndUpdateVolunteerStats (int i ) {
214- Volunteer Volunteer = com . somemore . domains . volunteer . domain . Volunteer .createDefault (NAVER , "oauth-id-" + i );
215- Volunteer .updateVolunteerStats (i * 10 , i );
216- volunteerRepository .save (Volunteer );
212+ Volunteer volunteer = Volunteer .createDefault (NAVER , "oauth-id-" + i );
213+ volunteer .updateVolunteerStats (i * 10 , i );
214+ volunteerRepository .save (volunteer );
217215 }
218216
219217 private static VolunteerRegisterRequestDto createVolunteerRegisterRequestDto (String name ) {
0 commit comments