Skip to content

Commit

Permalink
test: 누락 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
5uhwann committed Sep 17, 2023
1 parent 4928051 commit de321f6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,106 @@
public class UserFixture {

public static User 영문학과_16학번() {
return createUser("mj01", "1234", EnglishLevel.ENG12, "김영문", "60161001", 16, "영어영문", null, StudentCategory.NORMAL);
return createUser("mj01", "1234", EnglishLevel.ENG12, "김영문", "60161001", 16, "영어영문", null,
StudentCategory.NORMAL);
}

public static User 영문학과_18학번() {
return createUser("mj01", "1234", EnglishLevel.ENG12, "김영문", "60181001", 18, "영어영문", null, StudentCategory.NORMAL);
return createUser("mj01", "1234", EnglishLevel.ENG12, "김영문", "60181001", 18, "영어영문", null,
StudentCategory.NORMAL);
}

public static User 철학과_20학번() {
return createUser("mj51", "1234", EnglishLevel.ENG34, "김철학", "60201011", 20, "철학", null, StudentCategory.NORMAL);
return createUser("mj51", "1234", EnglishLevel.ENG34, "김철학", "60201011", 20, "철학", null,
StudentCategory.NORMAL);
}

public static User 행정학과_18학번() {
return createUser("mj11", "1234", EnglishLevel.ENG34, "김행정", "60181011", 18, "행정", null, StudentCategory.NORMAL);
return createUser("mj11", "1234", EnglishLevel.ENG34, "김행정", "60181011", 18, "행정", null,
StudentCategory.NORMAL);
}

public static User 행정학과_21학번() {
return createUser("mj12", "1234", EnglishLevel.ENG34, "김행정", "60211012", 21, "행정", null, StudentCategory.NORMAL);
return createUser("mj12", "1234", EnglishLevel.ENG34, "김행정", "60211012", 21, "행정", null,
StudentCategory.NORMAL);
}

public static User 경영학과_19학번_ENG12() {
return createUser("mj21", "1234", EnglishLevel.ENG12, "김경영", "60191021", 19, "경영", null, StudentCategory.NORMAL);
return createUser("mj21", "1234", EnglishLevel.ENG12, "김경영", "60191021", 19, "경영", null,
StudentCategory.NORMAL);
}

public static User 경영학과_19학번_ENG34() {
return createUser("mj21", "1234", EnglishLevel.ENG34, "김경영", "60191021", 19, "경영", null, StudentCategory.NORMAL);
return createUser("mj21", "1234", EnglishLevel.ENG34, "김경영", "60191021", 19, "경영", null,
StudentCategory.NORMAL);
}

public static User 경영학과_19학번_ENG34_복수전공() {
return createUser("mj21", "1234", EnglishLevel.ENG34, "김경영", "60191021", 19, "경영", "국제통상",
StudentCategory.NORMAL);
}

public static User 경영학과_19학번_영어_면제() {
return createUser("mj21", "1234", EnglishLevel.FREE, "김경영", "60191021", 19, "경영", null, StudentCategory.NORMAL);
}

public static User 경영학과_22학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김경영", "60221022", 22, "경영", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김경영", "60221022", 22, "경영", null,
StudentCategory.NORMAL);
}

public static User 경영학과_23학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김경영", "60231022", 23, "경영", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김경영", "60231022", 23, "경영", null,
StudentCategory.NORMAL);
}

public static User 국제통상학과_19학번() {
return createUser("mj31", "1234", EnglishLevel.ENG34, "김국통", "60192021", 19, "국제통상", null, StudentCategory.NORMAL);
return createUser("mj31", "1234", EnglishLevel.ENG34, "김국통", "60192021", 19, "국제통상", null,
StudentCategory.NORMAL);
}

public static User 데이테크놀로지학과_16학번() {
return createUser("mj1001", "1234", EnglishLevel.ENG12, "정데테", "60161666", 16, "데이터테크놀로지", null, StudentCategory.NORMAL);
return createUser("mj1001", "1234", EnglishLevel.ENG12, "정데테", "60161666", 16, "데이터테크놀로지", null,
StudentCategory.NORMAL);
}

public static User 데이테크놀로지학과_18학번() {
return createUser("mj1003", "1234", EnglishLevel.ENG12, "정데테", "60181666", 18, "데이터테크놀로지", null, StudentCategory.NORMAL);
return createUser("mj1003", "1234", EnglishLevel.ENG12, "정데테", "60181666", 18, "데이터테크놀로지", null,
StudentCategory.NORMAL);
}

public static User 응용소프트웨어학과_17학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60171022", 17, "응용소프트웨어", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60171022", 17, "응용소프트웨어", null,
StudentCategory.NORMAL);
}

public static User 응용소프트웨어학과_19학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "응용소프트웨어", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "응용소프트웨어", null,
StudentCategory.NORMAL);
}

public static User 응용소프트웨어학과_19학번_영어_면제() {
return createUser("mj22", "1234", EnglishLevel.FREE, "김응용", "60191022", 19, "응용소프트웨어", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.FREE, "김응용", "60191022", 19, "응용소프트웨어", null,
StudentCategory.NORMAL);
}

public static User 데이터테크놀로지학과_19학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "데이터테크놀로지", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "데이터테크놀로지", null,
StudentCategory.NORMAL);
}

public static User 디지털콘텐츠디자인학과_19학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "디지털콘텐츠디자인", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60191022", 19, "디지털콘텐츠디자인", null,
StudentCategory.NORMAL);
}

public static User 디지털콘텐츠디자인학과_23학번() {
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60231022", 23, "디지털콘텐츠디자인", null, StudentCategory.NORMAL);
return createUser("mj22", "1234", EnglishLevel.ENG34, "김응용", "60231022", 23, "디지털콘텐츠디자인", null,
StudentCategory.NORMAL);
}

public static User createUser(String authId, String password, EnglishLevel englishLevel, String name, String studentNumber,
public static User createUser(String authId, String password, EnglishLevel englishLevel, String name,
String studentNumber,
int entryYear, String major, String subMajor, StudentCategory studentCategory) {
return User.builder()
.authId(authId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,45 @@ void findSingleMajorUserGraduationRequirement() {
.contains(17, 12, 6, 10, 63, 20);
}

@DisplayName("복수 전공 유저의 입학년도에 해당하는 졸업요건을 반환한다.")
@Test
void findDualMajorUserGraduationRequirement() {
//given
List<GraduationRequirementJpaEntity> graduationRequirements = createBusinessGraduationRequirements();
graduationRequirementRepository.saveAll(graduationRequirements);

User user = UserFixture.경영학과_19학번_ENG34_복수전공();

//when
GraduationRequirement graduationRequirement = loadGraduationRequirementPersistenceAdapter.findGraduationRequirement(
user);

//then
Assertions.assertThat(graduationRequirement)
.extracting("subMajorCredit", "commonCultureCredit", "coreCultureCredit", "basicAcademica"
+ "lCredit", "normalCultureCredit", "majorCredit", "freeElectiveCredit")
.contains(SUB_MAJOR_CREDIT, 15, 12, 6, 10, 63, 22);
}

@DisplayName("영어 면제 유저의 졸업요건은 공통교양의 영어 카테고리 학점(6)이 일반교양 학점으로 이관된 졸업 요건이다.")
@Test
void findFreeEnglishLevelUserGraduationRequirement() {
//given
//given
List<GraduationRequirementJpaEntity> graduationRequirements = createBusinessGraduationRequirements();
graduationRequirementRepository.saveAll(graduationRequirements);

User user = UserFixture.경영학과_19학번_영어_면제();

//when
//when
GraduationRequirement graduationRequirement = loadGraduationRequirementPersistenceAdapter.findGraduationRequirement(
user);

//then
//then
Assertions.assertThat(graduationRequirement)
.extracting("commonCultureCredit", "normalCultureCredit")
.contains(11, 16);
}


private List<GraduationRequirementJpaEntity> createBusinessGraduationRequirements() {

//16~17 경영대 졸업 요건
Expand Down Expand Up @@ -109,7 +128,8 @@ private List<GraduationRequirementJpaEntity> createBusinessGraduationRequirement
.college(BUSINESS)
.subMajorCredit(SUB_MAJOR_CREDIT)
.startEntryYear(18)
.endEntryYear(23).commonCultureCredit(15)
.endEntryYear(23)
.commonCultureCredit(15)
.coreCultureCredit(12)
.basicAcademicalCredit(6)
.normalCultureCredit(10)
Expand Down

0 comments on commit de321f6

Please sign in to comment.