-
Notifications
You must be signed in to change notification settings - Fork 8
refactor: 유저 관련 통합 테스트 데이터 fixture 메서드로 변경 #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
0ff5c51
f7436ae
0ea67a9
82e8126
0e6c585
6e13ea6
64627fd
94037f5
313cf65
05e9733
86de879
0d06904
65dfc47
75f6294
a4f5d17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,8 @@ | |
| import com.example.solidconnection.score.domain.LanguageTestScore; | ||
| import com.example.solidconnection.score.repository.LanguageTestScoreRepository; | ||
| import com.example.solidconnection.siteuser.domain.SiteUser; | ||
| import com.example.solidconnection.siteuser.repository.SiteUserRepository; | ||
| import com.example.solidconnection.siteuser.fixture.SiteUserFixture; | ||
| import com.example.solidconnection.support.integration.BaseIntegrationTest; | ||
| import com.example.solidconnection.type.PreparationStatus; | ||
| import com.example.solidconnection.type.Role; | ||
| import com.example.solidconnection.type.VerifyStatus; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.DisplayName; | ||
|
|
@@ -39,26 +37,23 @@ class AdminLanguageTestScoreServiceTest extends BaseIntegrationTest { | |
| private AdminLanguageTestScoreService adminLanguageTestScoreService; | ||
|
|
||
| @Autowired | ||
| private SiteUserRepository siteUserRepository; | ||
| private LanguageTestScoreRepository languageTestScoreRepository; | ||
|
|
||
| @Autowired | ||
| private LanguageTestScoreRepository languageTestScoreRepository; | ||
| private SiteUserFixture siteUserFixture; | ||
|
Comment on lines
39
to
+43
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixture 를 맨 아래로 두신건 이게 덜중요하다는 생각 때문인가요?!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 주로 테스트를 하는 AdminLanguageTestScoreService를 제일 위에서 주입받는 게 일단 맞다고 생각했습니다! LanguageTestScoreRepository는 어차피 Fixture가 생기면 없어질 의존성이니 크게 신경을 안썼는데 주석으로 표시하면 좋았겠네요
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 의도가 궁금해서 질문드렸던거였어요 ㅎㅎ |
||
|
|
||
| private SiteUser siteUser1; | ||
| private SiteUser siteUser2; | ||
| private SiteUser siteUser3; | ||
| private LanguageTestScore languageTestScore1; | ||
| private LanguageTestScore languageTestScore2; | ||
| private LanguageTestScore languageTestScore3; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| siteUser1 = createSiteUser(1, "test1"); | ||
| siteUser2 = createSiteUser(2, "test2"); | ||
| siteUser3 = createSiteUser(3, "test3"); | ||
| languageTestScore3 = createLanguageTestScore(siteUser3, VerifyStatus.REJECTED); | ||
| languageTestScore2 = createLanguageTestScore(siteUser2, VerifyStatus.PENDING); | ||
| languageTestScore1 = createLanguageTestScore(siteUser1, VerifyStatus.PENDING); | ||
| SiteUser 테스트_유저_1 = siteUserFixture.테스트_유저(1, "test1"); | ||
| SiteUser 테스트_유저_2 = siteUserFixture.테스트_유저(2, "test2"); | ||
| SiteUser 테스트_유저_3 = siteUserFixture.테스트_유저(3, "test3"); | ||
| languageTestScore3 = createLanguageTestScore(테스트_유저_3, VerifyStatus.REJECTED); | ||
| languageTestScore2 = createLanguageTestScore(테스트_유저_2, VerifyStatus.PENDING); | ||
| languageTestScore1 = createLanguageTestScore(테스트_유저_1, VerifyStatus.PENDING); | ||
| } | ||
|
|
||
| @Nested | ||
|
|
@@ -219,17 +214,6 @@ class 어학점수_검증_및_수정 { | |
| } | ||
| } | ||
|
|
||
| private SiteUser createSiteUser(int index, String nickname) { | ||
| SiteUser siteUser = new SiteUser( | ||
| "test" + index + " @example.com", | ||
| nickname, | ||
| "profileImageUrl", | ||
| PreparationStatus.CONSIDERING, | ||
| Role.MENTEE | ||
| ); | ||
| return siteUserRepository.save(siteUser); | ||
| } | ||
|
|
||
| private LanguageTestScore createLanguageTestScore(SiteUser siteUser, VerifyStatus status) { | ||
| LanguageTestScore languageTestScore = new LanguageTestScore( | ||
| new LanguageTest(TOEIC, "500", "/toeic-report.pdf"), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기에도 "테스트_" 를 붙이신 이유가 있으신가요?
fixture 생성 함수에서도 그렇고, 변수명에서도 사용되니 규혁님이 이렇게 하신게 의도적일거라는 생각이 드네요~ 왜 이렇게 하셨는지 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위에 이야기를 듣고 나니 안붙이는 게 더 좋을 거 같다는 생각이 드네요! 새벽에 작업했었는데 깊게 생각하지 않고 작성했던 거 같아요 😅