-
Notifications
You must be signed in to change notification settings - Fork 5
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
[BE] issue241: 테스트 코드 리팩토링 #242
Merged
+794
−607
Merged
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
20656f8
refactor: ReviewDaoTest 리팩토링
tco0427 2bad521
refactor: createdDate 수정 및 schema 변경
tco0427 778c200
refactor: ReviewControllerTest 리팩토링
tco0427 db06960
refactor: MemberData Fixture 사용
tco0427 2e32b80
refactor: MyStudyControllerTest 리팩토링
tco0427 7ef8eb8
Merge branch 'develop' of https://github.com/woowacourse-teams/2022-m…
tco0427 65f6a01
refactor: MyStudyControllerTest 리팩토링 완료
tco0427 adfb22b
refactor: MyStudyDaoTest
tco0427 3a875e4
refactor: MyStudyDaoTest 수정 중
tco0427 64fa5b2
refactor: MyStudyDaoTest 완료
tco0427 d027489
fix: 깨지는 테스트 수정
tco0427 926f950
fix: id 값은 알 수 없으므로 null만 검사하도록 수정
tco0427 5de9bd5
refactor: MemberFixtures에서 Member 상수 -> 메서드로 변경
sc0116 34ac7f4
refactor: ReviewFixtures에서 Review 상수 -> 메서드로 변경
sc0116 38d6d3e
refactor: StudyDetailsDaoTest 리팩토링
tco0427 48a7f8f
Merge branch 'refactor/241-test-refactoring' of https://github.com/wo…
tco0427 d5bccdc
refactor: MyStudyServiceTest 리팩토링
tco0427 7e39ade
refactor: 불필요한 StudyFixtures 제거
tco0427 0e976f6
refactor: TagDaoTest 수정
tco0427 d0d87d8
refactor: ReviewDaoTest 리팩토링
tco0427 6d28741
refactor: 사용하지 않는 Fixture 제거
tco0427 4f7da73
fix: ReviewDaoTest 수정
tco0427 19b374e
feat: 스터디 최대 인원이 한명인 경우 바로 모집 종료가 된다.
tco0427 59a2a51
fix: 테스트 코드 통과하도록 수정
tco0427 36e69e7
refactor: 린론 피드백 반영
tco0427 1236b0f
Merge branch 'refactor/241-test-refactoring' of https://github.com/wo…
tco0427 7feb089
refactor: DTO 검증문 추가
tco0427 8ef9f56
fix: 테스트 수정
tco0427 e1efa66
refactor: 픽스쳐 추가
tco0427 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
backend/src/test/java/com/woowacourse/fixtures/AuthFixtures.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ public class MemberFixtures { | |
public static final String 짱구_유저네임 = "jjanggu"; | ||
public static final String 짱구_이미지 = "https://jjanggu.png"; | ||
public static final String 짱구_프로필 = "https://jjanggu.com"; | ||
public static final Member 짱구 = new Member(짱구_깃허브_아이디, 짱구_유저네임, 짱구_이미지, 짱구_프로필); | ||
public static final MemberData 짱구_응답 = new MemberData(짱구_깃허브_아이디, 짱구_유저네임, 짱구_이미지, 짱구_프로필); | ||
|
||
/* 그린론 */ | ||
|
@@ -20,7 +19,6 @@ public class MemberFixtures { | |
public static final String 그린론_유저네임 = "greenlawn"; | ||
public static final String 그린론_이미지 = "https://greenlawn.png"; | ||
public static final String 그린론_프로필 = "https://greenlawn.com"; | ||
public static final Member 그린론 = new Member(그린론_깃허브_아이디, 그린론_유저네임, 그린론_이미지, 그린론_프로필); | ||
public static final MemberData 그린론_응답 = new MemberData(그린론_깃허브_아이디, 그린론_유저네임, 그린론_이미지, 그린론_프로필); | ||
|
||
/* 디우 */ | ||
|
@@ -29,7 +27,6 @@ public class MemberFixtures { | |
public static final String 디우_유저네임 = "dwoo"; | ||
public static final String 디우_이미지 = "https://dwoo.png"; | ||
public static final String 디우_프로필 = "https://dwoo.com"; | ||
public static final Member 디우 = new Member(디우_깃허브_아이디, 디우_유저네임, 디우_이미지, 디우_프로필); | ||
public static final MemberData 디우_응답 = new MemberData(디우_깃허브_아이디, 디우_유저네임, 디우_이미지, 디우_프로필); | ||
|
||
/* 베루스 */ | ||
|
@@ -38,24 +35,43 @@ public class MemberFixtures { | |
public static final String 베루스_유저네임 = "verus"; | ||
public static final String 베루스_이미지 = "https://verus.png"; | ||
public static final String 베루스_프로필 = "https://verus.com"; | ||
public static final Member 베루스 = new Member(베루스_깃허브_아이디, 베루스_유저네임, 베루스_이미지, 베루스_프로필); | ||
public static final MemberData 베루스_응답 = new MemberData(베루스_깃허브_아이디, 베루스_유저네임, 베루스_이미지, 베루스_프로필); | ||
|
||
/* 병민 */ | ||
public static final Long 병민_아이디 = 5L; | ||
public static final Long 병민_깃허브_아이디 = 5L; | ||
public static final String 병민_유저네임 = "airman"; | ||
public static final String 병민_이미지 = "https://airman.png"; | ||
public static final String 병민_프로필 = "https://airman.com"; | ||
public static final Member 병민 = new Member(병민_깃허브_아이디, 병민_유저네임, 병민_이미지, 병민_프로필); | ||
public static final MemberData 병민_응답 = new MemberData(병민_깃허브_아이디, 병민_유저네임, 병민_이미지, 병민_프로필); | ||
|
||
/* 태태 */ | ||
public static final Long 태태_아이디 = 6L; | ||
public static final Long 태태_깃허브_아이디 = 6L; | ||
public static final String 태태_유저네임 = "nannoo"; | ||
public static final String 태태_이미지 = "https://nannoo.png"; | ||
public static final String 태태_프로필 = "https://nannoo.com"; | ||
public static final Member 태태 = new Member(태태_깃허브_아이디, 태태_유저네임, 태태_이미지, 태태_프로필); | ||
public static final MemberData 태태_응답 = new MemberData(태태_깃허브_아이디, 태태_유저네임, 태태_이미지, 태태_프로필); | ||
|
||
public static Member 짱구() { | ||
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. 👍 |
||
return new Member(짱구_깃허브_아이디, 짱구_유저네임, 짱구_이미지, 짱구_프로필); | ||
} | ||
|
||
public static Member 그린론() { | ||
return new Member(그린론_깃허브_아이디, 그린론_유저네임, 그린론_이미지, 그린론_프로필); | ||
} | ||
|
||
public static Member 디우() { | ||
return new Member(디우_깃허브_아이디, 디우_유저네임, 디우_이미지, 디우_프로필); | ||
} | ||
|
||
public static Member 베루스() { | ||
return new Member(베루스_깃허브_아이디, 베루스_유저네임, 베루스_이미지, 베루스_프로필); | ||
} | ||
|
||
public static Member 병민() { | ||
return new Member(병민_깃허브_아이디, 병민_유저네임, 병민_이미지, 병민_프로필); | ||
} | ||
|
||
public static Member 태태() { | ||
return new Member(태태_깃허브_아이디, 태태_유저네임, 태태_이미지, 태태_프로필); | ||
} | ||
} |
67 changes: 35 additions & 32 deletions
67
backend/src/test/java/com/woowacourse/fixtures/ReviewFixtures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,50 @@ | ||
package com.woowacourse.fixtures; | ||
|
||
import static com.woowacourse.fixtures.MemberFixtures.그린론_아이디; | ||
import static com.woowacourse.fixtures.MemberFixtures.그린론_응답; | ||
import static com.woowacourse.fixtures.MemberFixtures.디우_아이디; | ||
import static com.woowacourse.fixtures.MemberFixtures.디우_응답; | ||
import static com.woowacourse.fixtures.MemberFixtures.베루스_아이디; | ||
import static com.woowacourse.fixtures.MemberFixtures.베루스_응답; | ||
import static com.woowacourse.fixtures.MemberFixtures.짱구_아이디; | ||
import static com.woowacourse.fixtures.MemberFixtures.짱구_응답; | ||
import static com.woowacourse.fixtures.StudyFixtures.자바_스터디_아이디; | ||
|
||
import com.woowacourse.moamoa.review.domain.AssociatedStudy; | ||
import com.woowacourse.moamoa.review.domain.Review; | ||
import com.woowacourse.moamoa.review.domain.Reviewer; | ||
import com.woowacourse.moamoa.review.query.data.ReviewData; | ||
import java.time.LocalDate; | ||
|
||
public class ReviewFixtures { | ||
|
||
/* 자바 스터디 리뷰 */ | ||
public static final Long 자바_리뷰1_아이디 = 1L; | ||
public static final String 자바_리뷰1_내용 = "자바 스터디 첫 번째 리뷰입니다."; | ||
public static final Review 자바_리뷰1 = new Review(new AssociatedStudy(자바_스터디_아이디), new Reviewer(짱구_아이디), 자바_리뷰1_내용); | ||
public static final ReviewData 자바_리뷰1_데이터 = new ReviewData(자바_리뷰1_아이디, 짱구_응답, | ||
LocalDate.of(2022, 10, 9), LocalDate.of(2022, 10, 9), 자바_리뷰1_내용); | ||
|
||
public static final Long 자바_리뷰2_아이디 = 2L; | ||
public static final String 자바_리뷰2_내용 = "자바 스터디 두 번째 리뷰입니다."; | ||
public static final Review 자바_리뷰2 = new Review(new AssociatedStudy(자바_스터디_아이디), new Reviewer(베루스_아이디), 자바_리뷰2_내용); | ||
public static final ReviewData 자바_리뷰2_데이터 = new ReviewData(자바_리뷰2_아이디, 베루스_응답, | ||
LocalDate.of(2022, 10, 9), LocalDate.of(2022, 10, 10), 자바_리뷰2_내용); | ||
|
||
public static final Long 자바_리뷰3_아이디 = 3L; | ||
public static final String 자바_리뷰3_내용 = "자바 스터디 세 번째 리뷰입니다."; | ||
public static final Review 자바_리뷰3 = new Review(new AssociatedStudy(자바_스터디_아이디), new Reviewer(그린론_아이디), 자바_리뷰3_내용); | ||
public static final ReviewData 자바_리뷰3_데이터 = new ReviewData(자바_리뷰3_아이디, 그린론_응답, | ||
LocalDate.of(2022, 10, 10), LocalDate.of(2022, 10, 10), 자바_리뷰3_내용); | ||
|
||
public static final Long 자바_리뷰4_아이디 = 4L; | ||
public static final String 자바_리뷰4_내용 = "자바 스터디 네 번째 리뷰입니다."; | ||
public static final Review 자바_리뷰4 = new Review(new AssociatedStudy(자바_스터디_아이디), new Reviewer(디우_아이디), 자바_리뷰4_내용); | ||
public static final ReviewData 자바_리뷰4_데이터 = new ReviewData(자바_리뷰4_아이디, 디우_응답, | ||
LocalDate.of(2022, 10, 14), LocalDate.of(2022, 10, 15), 자바_리뷰4_내용); | ||
|
||
public static final int 자바_리뷰_총_개수 = 4; | ||
public static final String 리액트_리뷰1_내용 = "리액트 스터디 첫 번째 리뷰입니다."; | ||
public static final String 리액트_리뷰2_내용 = "리액트 스터디 두 번째 리뷰입니다."; | ||
public static final String 리액트_리뷰3_내용 = "리액트 스터디 세 번째 리뷰입니다."; | ||
|
||
public static Review 자바_리뷰1(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 자바_리뷰1_내용); | ||
} | ||
|
||
public static Review 자바_리뷰2(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 자바_리뷰2_내용); | ||
} | ||
|
||
public static Review 자바_리뷰3(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 자바_리뷰3_내용); | ||
} | ||
|
||
public static Review 자바_리뷰4(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 자바_리뷰4_내용); | ||
} | ||
|
||
public static Review 리액트_리뷰1(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 리액트_리뷰1_내용); | ||
} | ||
|
||
public static Review 리액트_리뷰2(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 리액트_리뷰2_내용); | ||
} | ||
|
||
public static Review 리액트_리뷰3(final Long studyId, final Long memberId) { | ||
return 리뷰(studyId, memberId, 리액트_리뷰3_내용); | ||
} | ||
|
||
private static Review 리뷰(final Long studyId, final Long reviewerId, final String content) { | ||
return new Review(new AssociatedStudy(studyId), new Reviewer(reviewerId), content); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이런 식으로 CreatingStudyRequest.mapToRecruitPlan 메서드안에 넣는게 좋아보여요
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.
RecruitPlanner
도메인의 로직도 제거할 수 있고, Service 쪽 private 메소드도 제거 가능해지네요!