Skip to content

Commit

Permalink
[BE] test: fixture 추가 (#538)
Browse files Browse the repository at this point in the history
* test: fixture 추가

* test: fixture 인자에 position 추가
  • Loading branch information
nayonsoso authored Aug 28, 2024
1 parent 0ae1630 commit 4d5bcc6
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/src/test/java/reviewme/fixture/OptionGroupFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package reviewme.fixture;

import reviewme.question.domain.OptionGroup;

public class OptionGroupFixture {

public OptionGroup 선택지_그룹(long questionId) {
return new OptionGroup(questionId, 1, 2);
}
}
15 changes: 15 additions & 0 deletions backend/src/test/java/reviewme/fixture/OptionItemFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package reviewme.fixture;

import reviewme.question.domain.OptionItem;
import reviewme.question.domain.OptionType;

public class OptionItemFixture {

public OptionItem 선택지(long optionGroupId) {
return new OptionItem("선택지 본문", optionGroupId, 1, OptionType.CATEGORY);
}

public OptionItem 선택지(long optionGroupId, int position) {
return new OptionItem("선택지 본문", optionGroupId, 1, OptionType.CATEGORY);
}
}
39 changes: 39 additions & 0 deletions backend/src/test/java/reviewme/fixture/QuestionFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package reviewme.fixture;

import reviewme.question.domain.Question;
import reviewme.question.domain.QuestionType;

public class QuestionFixture {

public Question 선택형_필수_질문() {
return this.선택형_필수_질문(1);
}

public Question 선택형_필수_질문(int position) {
return new Question(true, QuestionType.CHECKBOX, "본문", null, position);
}

public Question 선택형_옵션_질문() {
return this.선택형_옵션_질문(1);
}

public Question 선택형_옵션_질문(int position) {
return new Question(false, QuestionType.CHECKBOX, "본문", null, position);
}

public Question 서술형_필수_질문() {
return this.서술형_필수_질문(1);
}

public Question 서술형_필수_질문(int position) {
return new Question(true, QuestionType.TEXT, "본문", null, position);
}

public Question 서술형_옵션_질문() {
return this.서술형_옵션_질문(1);
}

public Question 서술형_옵션_질문(int position) {
return new Question(false, QuestionType.TEXT, "본문", null, position);
}
}
14 changes: 14 additions & 0 deletions backend/src/test/java/reviewme/fixture/ReviewGroupFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package reviewme.fixture;

import reviewme.reviewgroup.domain.ReviewGroup;

public class ReviewGroupFixture {

public ReviewGroup 리뷰_그룹() {
return this.리뷰_그룹("reviewRequestCode", "groupAccessCode");
}

public ReviewGroup 리뷰_그룹(String reviewRequestCode, String groupAccessCode) {
return new ReviewGroup("revieweeName", "projectName", reviewRequestCode, groupAccessCode);
}
}
24 changes: 24 additions & 0 deletions backend/src/test/java/reviewme/fixture/SectionFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package reviewme.fixture;

import java.util.List;
import reviewme.template.domain.Section;
import reviewme.template.domain.VisibleType;

public class SectionFixture {

public Section 항상_보이는_섹션(List<Long> questionIds) {
return this.항상_보이는_섹션(questionIds, 1);
}

public Section 항상_보이는_섹션(List<Long> questionIds, int position) {
return new Section(VisibleType.ALWAYS, questionIds, null, "섹션명", "머릿말", position);
}

public Section 조건부로_보이는_섹션(List<Long> questionIds, long onSelectedOptionId) {
return this.조건부로_보이는_섹션(questionIds, onSelectedOptionId, 1);
}

public Section 조건부로_보이는_섹션(List<Long> questionIds, long onSelectedOptionId, int position) {
return new Section(VisibleType.CONDITIONAL, questionIds, onSelectedOptionId, "섹션명", "머릿말", position);
}
}
11 changes: 11 additions & 0 deletions backend/src/test/java/reviewme/fixture/TemplateFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package reviewme.fixture;

import java.util.List;
import reviewme.template.domain.Template;

public class TemplateFixture {

public Template 템플릿(List<Long> sectionIds) {
return new Template(sectionIds);
}
}

0 comments on commit 4d5bcc6

Please sign in to comment.