-
Notifications
You must be signed in to change notification settings - Fork 3
[DDING-000] FormApplication 도메인 Repository 테스트 코드 작성 및 리팩토링 #354
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
85f74aa
test: findTopDepartmentsByFormId 쿼리 검증
Seooooo24 93e9c88
test: findRecentFormByDateWithApplicationCount 쿼리 검증
Seooooo24 ca655d6
test: findAllFinalPassedByFormId 쿼리 검증
Seooooo24 b9be5b0
test: fixtureMonkey 의존성 제거
Seooooo24 6d96736
refactor: 픽스처 클래스 사용하도록 변경
Seooooo24 f0ba4fa
fix: 오타 수정
Seooooo24 0e57b03
test: FormAnswerFixture, FormFieldFixture 생성
Seooooo24 26f9ec9
refactor: FileMetaDataFixture 메소드 추가
Seooooo24 f702988
refactor: FormApplicationFixture 메서드 이름 변경 및 추가
Seooooo24 f7ca2ac
test: FormApplication 도메인 리포지토리 테스트
Seooooo24 914f992
refactor: 리뷰 반영하여 수정
Seooooo24 5737d35
refactor: 리뷰 반영하여 수정
Seooooo24 5245cf3
refactor: 리뷰 반영하여 수정
Seooooo24 8baaca4
refactor: 리뷰 반영하여 수정
Seooooo24 51d7797
refactor: 리뷰 반영하여 수정
Seooooo24 eb695ec
refactor: 리뷰 반영하여 수정
Seooooo24 cd6ffd2
git merge
Seooooo24 5b06b6a
refactor: CI 테스트 실패로 인한 쿼리 수정
Seooooo24 00d4d0c
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 a7d669a
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 b1c4f13
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 f1419f4
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 17d7241
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 48307f7
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 fca04f0
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 92ff917
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 e611ac1
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 fd09765
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 05f71b0
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 4a2b242
refactor: CI 테스트 실패로 인한 테스트 수정
Seooooo24 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
25 changes: 25 additions & 0 deletions
25
src/test/java/ddingdong/ddingdongBE/common/fixture/FormAnswerFixture.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package ddingdong.ddingdongBE.common.fixture; | ||
|
|
||
| import ddingdong.ddingdongBE.domain.form.entity.FormField; | ||
| import ddingdong.ddingdongBE.domain.formapplication.entity.FormAnswer; | ||
| import ddingdong.ddingdongBE.domain.formapplication.entity.FormApplication; | ||
| import java.util.List; | ||
|
|
||
| public class FormAnswerFixture { | ||
|
|
||
| public static FormAnswer create(FormApplication formApplication, FormField formField) { | ||
| return FormAnswer.builder() | ||
| .formApplication(formApplication) | ||
| .formField(formField) | ||
| .value(List.of("답변")) | ||
| .build(); | ||
| } | ||
|
|
||
| public static FormAnswer create(FormApplication formApplication, FormField formField, List<String> value) { | ||
| return FormAnswer.builder() | ||
| .formApplication(formApplication) | ||
| .formField(formField) | ||
| .value(value) | ||
| .build(); | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,11 +6,24 @@ | |
|
|
||
| public class FormApplicationFixture { | ||
|
|
||
| public static FormApplication create(String name, Form form) { | ||
| public static FormApplication create(Form form) { | ||
| return FormApplication.builder() | ||
| .name("이름") | ||
| .studentNumber("20231234") | ||
| .department("학과") | ||
| .phoneNumber("010-1234-5678") | ||
| .email("[email protected]") | ||
| .status(FormApplicationStatus.SUBMITTED) | ||
| .form(form) | ||
| .deletedAt(null) | ||
| .build(); | ||
| } | ||
|
|
||
| public static FormApplication create(Form form, String name, String department) { | ||
| return FormApplication.builder() | ||
| .name(name) | ||
| .studentNumber("20231234") | ||
| .department("컴퓨터공학과") | ||
| .department(department) | ||
| .phoneNumber("010-1234-5678") | ||
| .email("[email protected]") | ||
| .status(FormApplicationStatus.SUBMITTED) // 예시 상태, 필요에 따라 바꿔도 됨 | ||
|
|
@@ -19,6 +32,19 @@ public static FormApplication create(String name, Form form) { | |
| .build(); | ||
| } | ||
|
|
||
| public static FormApplication create(Form form, FormApplicationStatus status) { | ||
| return FormApplication.builder() | ||
| .name("이름") | ||
| .studentNumber("20231234") | ||
| .department("학과") | ||
| .phoneNumber("010-1234-5678") | ||
| .email("[email protected]") | ||
| .status(status) | ||
| .form(form) | ||
| .deletedAt(null) | ||
| .build(); | ||
| } | ||
|
|
||
| public static FormApplication pendingFormApplication() { | ||
| return FormApplication.builder() | ||
| .name("이름") | ||
|
|
||
33 changes: 33 additions & 0 deletions
33
src/test/java/ddingdong/ddingdongBE/common/fixture/FormFieldFixture.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package ddingdong.ddingdongBE.common.fixture; | ||
|
|
||
| import ddingdong.ddingdongBE.domain.form.entity.FieldType; | ||
| import ddingdong.ddingdongBE.domain.form.entity.Form; | ||
| import ddingdong.ddingdongBE.domain.form.entity.FormField; | ||
| import java.util.List; | ||
|
|
||
| public class FormFieldFixture { | ||
|
|
||
| public static FormField create(Form form) { | ||
| return FormField.builder() | ||
| .section("섹션") | ||
| .fieldType(FieldType.RADIO) | ||
| .form(form) | ||
| .question("질문") | ||
| .options(List.of("선택지")) | ||
| .required(false) | ||
| .fieldOrder(1) | ||
| .build(); | ||
| } | ||
|
|
||
| public static FormField create(Form form, String question) { | ||
| return FormField.builder() | ||
| .section("섹션") | ||
| .fieldType(FieldType.RADIO) | ||
| .form(form) | ||
| .question(question) | ||
| .options(List.of("선택지")) | ||
| .required(false) | ||
| .fieldOrder(1) | ||
| .build(); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
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.
🛠️ Refactor suggestion | 🟠 Major
중복된 메서드를 제거하세요.
createForm(Club, LocalDate, LocalDate)(27-37번 줄)과createFormWithStartAndEndDate(Club, LocalDate, LocalDate)(81-91번 줄)는 메서드 이름만 다를 뿐 완전히 동일한 구현을 가지고 있습니다. 둘 중 하나를 제거하여 코드 중복을 해소하세요.🔎 수정 제안
createFormWithStartAndEndDate메서드를 제거하고createForm(Club, LocalDate, LocalDate)만 사용하도록 통일하세요:Also applies to: 81-91
🤖 Prompt for AI Agents