From 75e9c8fc6f5e01aed9063e5fdb198e01dfa1b60c Mon Sep 17 00:00:00 2001 From: 5uhwann <106325839+5uhwann@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:05:08 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=95=B5=EC=8B=AC=EA=B5=90?= =?UTF-8?q?=EC=96=91=20=EC=A1=B8=EC=97=85=20=EA=B3=84=EC=82=B0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84=20(#161)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 누락 로직 추가 * chore: 핵심교양 데이터 추가 * test: 핵심교양 fixture 작성 * test: 핵심교양 세부 카테고리 결과 테스트 작성 * feat: 핵심교양 세부 카테고리 결과 반환 구현 * test: 불필요 import 제거 * test: fixture 클래스명 변경 * test: 핵심교양 세부 졸업 결과 테스트 작성 * test: 핵심교양 세부 졸업 결과 반환 구현 * refactor: 세부 카테고리 잔여 학점 관련 필드 추가 * test: 핵심교양 - 과학과기술 예외사항 로직 테스트 작성 * feat: 핵심교양 - 과학과기술 예외사항 로직 구현 * test: 핵심교양 문화와예술 예외사항 로직 테스트 작성 * test: 핵심교양 문화와예술 예외사항 로직 구현 * refactor: DetailCategoryResult leftCredit 계산 로직 수정 --- .../domain/model/DetailCategoryResult.java | 37 +++- .../BusinessBasicAcademicalManager.java | 6 +- .../DefaultBasicAcademicalManager.java | 10 +- .../SocialScienceBasicAcademicManager.java | 15 +- .../CommonCultureDetailCategoryManager.java | 16 +- .../CoreCultureDetailCategoryManager.java | 79 +++++++++ .../CoreCultureGraduationManager.java | 31 ++++ .../lecture/domain/model/CoreCulture.java | 23 +++ .../domain/model/CoreCultureCategory.java | 18 ++ .../lecture/domain/model/Lecture.java | 6 + .../fixture/CoreCultureCategoryFixture.java | 28 ++++ .../fixture/CoreCultureFixture.java | 71 ++++++++ .../fixture/UserFixture.java | 15 ++ .../CoreCultureDetailCategoryManagerTest.java | 158 ++++++++++++++++++ .../CoreCultureGraduationManagerTest.java | 103 ++++++++++++ src/test/resources/lecture.csv | 23 +++ 16 files changed, 613 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManager.java create mode 100644 src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManager.java create mode 100644 src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCulture.java create mode 100644 src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCultureCategory.java create mode 100644 src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureCategoryFixture.java create mode 100644 src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureFixture.java create mode 100644 src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManagerTest.java create mode 100644 src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManagerTest.java diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/model/DetailCategoryResult.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/model/DetailCategoryResult.java index 811189e1..6ae4f9a8 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/model/DetailCategoryResult.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/model/DetailCategoryResult.java @@ -17,6 +17,8 @@ public class DetailCategoryResult { private final boolean isSatisfiedMandatory; private final int totalCredits; private int takenCredits; + private int normalLeftCredit; + private int freeElectiveLeftCredit; private final List takenMandatoryLectures = new ArrayList<>(); private final List haveToMandatoryLectures = new ArrayList<>(); private final List takenElectiveLectures = new ArrayList<>(); @@ -24,12 +26,14 @@ public class DetailCategoryResult { @Builder private DetailCategoryResult(String detailCategoryName, boolean isCompleted, boolean isSatisfiedMandatory, - int totalCredits, int takenCredits) { + int totalCredits, int takenCredits, int normalLeftCredit, int freeElectiveLeftCredit) { this.detailCategoryName = detailCategoryName; this.isCompleted = isCompleted; this.isSatisfiedMandatory = isSatisfiedMandatory; this.totalCredits = totalCredits; this.takenCredits = takenCredits; + this.normalLeftCredit = normalLeftCredit; + this.freeElectiveLeftCredit = freeElectiveLeftCredit; } public static DetailCategoryResult create(String detailCategoryName, boolean isSatisfiedMandatory, @@ -40,16 +44,27 @@ public static DetailCategoryResult create(String detailCategoryName, boolean isS .isSatisfiedMandatory(isSatisfiedMandatory) .totalCredits(totalCredits) .takenCredits(0) + .normalLeftCredit(0) + .freeElectiveLeftCredit(0) .build(); } - public void calculate(Set taken, Set basicAcademicalLectures) { + public void calculate(Set taken, Set graduationLectures) { addTakenLectures(taken); + calculateLeftCredit(); if(!checkCompleted()) { - addMandatoryLectures(taken, basicAcademicalLectures); + addMandatoryLectures(taken, graduationLectures); } } + public void addNormalLeftCredit(int normalLeftCredit) { + this.normalLeftCredit += normalLeftCredit; + } + + public void addFreeElectiveLeftCredit(int freeElectiveLeftCredit) { + this.freeElectiveLeftCredit += freeElectiveLeftCredit; + } + private void addTakenLectures(Set taken) { taken.forEach(lecture -> { takenMandatoryLectures.add(lecture); @@ -57,9 +72,19 @@ private void addTakenLectures(Set taken) { }); } - private void addMandatoryLectures(Set taken, Set basicAcademicalLectures) { - basicAcademicalLectures.removeAll(taken); - haveToMandatoryLectures.addAll(basicAcademicalLectures); + private void calculateLeftCredit() { + int leftCredit = takenCredits - totalCredits; + if (leftCredit > 0) { + if (detailCategoryName.equals("전공")) { + freeElectiveLeftCredit = leftCredit; + } + normalLeftCredit = leftCredit; + } + } + + private void addMandatoryLectures(Set taken, Set graduationLectures) { + graduationLectures.removeAll(taken); + haveToMandatoryLectures.addAll(graduationLectures); } private boolean checkCompleted() { diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/BusinessBasicAcademicalManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/BusinessBasicAcademicalManager.java index 3cc1a950..110eef13 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/BusinessBasicAcademicalManager.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/BusinessBasicAcademicalManager.java @@ -38,8 +38,6 @@ public DetailGraduationResult createDetailGraduationResult(StudentInformation st Set takenLectures, Set graduationLectures, int basicAcademicalCredit) { Set basicAcademicalLectures = convertToLectureSet(graduationLectures); - DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( - BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); Set removedTakenLecture = new HashSet<>(); Set taken = new HashSet<>(); @@ -52,9 +50,11 @@ public DetailGraduationResult createDetailGraduationResult(StudentInformation st removedTakenLecture.add(takenLecture); taken.add(takenLecture.getLecture()); }); + takenLectures.removeAll(removedTakenLecture); + DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( + BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); detailCategoryResult.calculate(taken, basicAcademicalLectures); - takenLectures.removeAll(removedTakenLecture); return DetailGraduationResult.create(BASIC_ACADEMICAL_CULTURE, basicAcademicalCredit, List.of(detailCategoryResult)); diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/DefaultBasicAcademicalManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/DefaultBasicAcademicalManager.java index dabc9285..7ba92472 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/DefaultBasicAcademicalManager.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/DefaultBasicAcademicalManager.java @@ -24,12 +24,10 @@ public boolean isSatisfied(StudentInformation studentInformation) { } @Override - public DetailGraduationResult createDetailGraduationResult(StudentInformation studentInformation, Set takenLectures, + public DetailGraduationResult createDetailGraduationResult(StudentInformation studentInformation, + Set takenLectures, Set graduationLectures, int basicAcademicalCredit) { - DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( - BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); - Set basicAcademicalLectures = convertToLectureSet(graduationLectures); Set removedTakenLecture = new HashSet<>(); @@ -41,9 +39,11 @@ public DetailGraduationResult createDetailGraduationResult(StudentInformation st removedTakenLecture.add(takenLecture); taken.add(takenLecture.getLecture()); }); + takenLectures.removeAll(removedTakenLecture); + DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( + BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); detailCategoryResult.calculate(taken, basicAcademicalLectures); - takenLectures.removeAll(removedTakenLecture); return DetailGraduationResult.create(BASIC_ACADEMICAL_CULTURE, basicAcademicalCredit, List.of(detailCategoryResult)); diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/SocialScienceBasicAcademicManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/SocialScienceBasicAcademicManager.java index ddabe25d..0ce3ff3f 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/SocialScienceBasicAcademicManager.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/basicacademicalculture/SocialScienceBasicAcademicManager.java @@ -20,7 +20,7 @@ public class SocialScienceBasicAcademicManager implements BasicAcademicalManager Lecture.of("KMD02102", "국제정치의이해", 3, 0, null), Lecture.of("KMD02108", "현대사회와정보", 3, 0, null), Lecture.of("KMD02140", "경제학들어가기", 3, 0, null), - Lecture.of( "KMD02186", "직무커뮤니케이션능력개발", 3, 0, null), + Lecture.of("KMD02186", "직무커뮤니케이션능력개발", 3, 0, null), Lecture.of("KMD02113", "인간관계와커뮤니케이션", 3, 0, null), Lecture.of("KMD02104", "인터넷과커뮤니케이션", 3, 0, null), Lecture.of("KMD02114", "미시경제학원론", 3, 0, null), @@ -34,12 +34,10 @@ public boolean isSatisfied(StudentInformation studentInformation) { } @Override - public DetailGraduationResult createDetailGraduationResult(StudentInformation studentInformation, Set takenLectures, + public DetailGraduationResult createDetailGraduationResult(StudentInformation studentInformation, + Set takenLectures, Set graduationLectures, int basicAcademicalCredit) { Set basicAcademicalLectures = convertToLectureSet(graduationLectures); - - DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( - BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); Set removedTakenLecture = new HashSet<>(); Set taken = new HashSet<>(); @@ -51,10 +49,13 @@ public DetailGraduationResult createDetailGraduationResult(StudentInformation st removedTakenLecture.add(takenLecture); taken.add(takenLecture.getLecture()); }); + takenLectures.removeAll(removedTakenLecture); + DetailCategoryResult detailCategoryResult = DetailCategoryResult.create( + BASIC_ACADEMICAL_CULTURE.getName(), true, basicAcademicalCredit); detailCategoryResult.calculate(taken, basicAcademicalLectures); - takenLectures.removeAll(removedTakenLecture); - return DetailGraduationResult.create(BASIC_ACADEMICAL_CULTURE, 12, List.of(detailCategoryResult)); + return DetailGraduationResult.create(BASIC_ACADEMICAL_CULTURE, basicAcademicalCredit, + List.of(detailCategoryResult)); } } diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/commonculture/CommonCultureDetailCategoryManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/commonculture/CommonCultureDetailCategoryManager.java index 1b4f70a5..17f48b08 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/commonculture/CommonCultureDetailCategoryManager.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/commonculture/CommonCultureDetailCategoryManager.java @@ -17,19 +17,25 @@ class CommonCultureDetailCategoryManager { public DetailCategoryResult generate(Set takenLectures, Set graduationLectures, CommonCultureCategory category) { - DetailCategoryResult commonCultureDetailCategoryResult = DetailCategoryResult.create( - category.getName(), checkMandatorySatisfaction(takenLectures, category), category.getTotalCredit()); - Set taken = new HashSet<>(); - Set graduationCommonCultureLectures = categorizeCommonCultures( graduationLectures, category); + Set removedTakenLecture = new HashSet<>(); + Set taken = new HashSet<>(); + takenLectures.stream() .filter(takenLecture -> graduationCommonCultureLectures.contains(takenLecture.getLecture())) - .forEach(takenLecture -> taken.add(takenLecture.getLecture())); + .forEach(takenLecture -> { + removedTakenLecture.add(takenLecture); + taken.add(takenLecture.getLecture()); + }); + DetailCategoryResult commonCultureDetailCategoryResult = DetailCategoryResult.create( + category.getName(), checkMandatorySatisfaction(takenLectures, category), category.getTotalCredit()); commonCultureDetailCategoryResult.calculate(taken, graduationCommonCultureLectures); + takenLectures.removeAll(removedTakenLecture); + return commonCultureDetailCategoryResult; } diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManager.java new file mode 100644 index 00000000..b11333e7 --- /dev/null +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManager.java @@ -0,0 +1,79 @@ +package com.plzgraduate.myongjigraduatebe.graduation.domain.service.coreculture; + +import static com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.Semester.*; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import com.plzgraduate.myongjigraduatebe.graduation.domain.model.DetailCategoryResult; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.Lecture; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.TakenLecture; +import com.plzgraduate.myongjigraduatebe.user.domain.model.StudentInformation; + +public class CoreCultureDetailCategoryManager { + + private static final List ICT_DEPARTMENTS = List.of( + "응용소프트웨어학과", + "데이터테크놀로지학과", + "디지털콘텐츠디자인학과"); + private static final Lecture 과학과기술_예외_과목 = Lecture.from("KMA02136"); + private static final Set 문화와예술_예외_과목 = Set.of( + Lecture.from("KMA02155"), + Lecture.from("KMA02156")); + + public DetailCategoryResult generate(StudentInformation studentInformation, Set takenLectures, + Set graduationLectures, CoreCultureCategory category) { + Set graduationCoreCultureLectures = categorizeCommonCultures(graduationLectures, category); + Set finishedTakenLecture = new HashSet<>(); + Set taken = new HashSet<>(); + + takenLectures.stream() + .filter(takenLecture -> graduationCoreCultureLectures.contains(takenLecture.getLecture())) + .forEach(takenLecture -> { + finishedTakenLecture.add(takenLecture); + taken.add(takenLecture.getLecture()); + }); + takenLectures.removeAll(finishedTakenLecture); + + DetailCategoryResult commonCultureDetailCategoryResult = DetailCategoryResult.create( + category.getName(), true, category.getTotalCredit()); + calculateFreeElectiveLeftCredit(studentInformation, taken, commonCultureDetailCategoryResult); + calculateNormalLeftCredit(taken, finishedTakenLecture, commonCultureDetailCategoryResult); + commonCultureDetailCategoryResult.calculate(taken, graduationCoreCultureLectures); + + return commonCultureDetailCategoryResult; + } + + private Set categorizeCommonCultures(Set graduationLectures, + CoreCultureCategory category) { + return graduationLectures.stream() + .filter(coreCulture -> coreCulture.getCoreCultureCategory() == category) + .map(CoreCulture::getLecture) + .collect(Collectors.toSet()); + } + + private void calculateFreeElectiveLeftCredit(StudentInformation studentInformation, Set taken, + DetailCategoryResult commonCultureDetailCategoryResult) { + if (ICT_DEPARTMENTS.contains(studentInformation.getDepartment()) && (taken.contains(과학과기술_예외_과목))) { + taken.remove(과학과기술_예외_과목); + int exceptionLectureCredit = 3; + commonCultureDetailCategoryResult.addFreeElectiveLeftCredit(exceptionLectureCredit); + } + } + + private void calculateNormalLeftCredit(Set taken, Set finishedTakenLecture, + DetailCategoryResult commonCultureDetailCategoryResult) { + int normalLeftCredit = finishedTakenLecture.stream() + .filter(takenLecture -> 문화와예술_예외_과목.contains(takenLecture.getLecture()) + && takenLecture.getYear() == 2022 + && takenLecture.getSemester() == FIRST) + .mapToInt(takenLecture -> takenLecture.getLecture().getCredit()) + .sum(); + taken.removeAll(문화와예술_예외_과목); + commonCultureDetailCategoryResult.addNormalLeftCredit(normalLeftCredit); + } +} diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManager.java b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManager.java new file mode 100644 index 00000000..b94712d4 --- /dev/null +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManager.java @@ -0,0 +1,31 @@ +package com.plzgraduate.myongjigraduatebe.graduation.domain.service.coreculture; + +import static com.plzgraduate.myongjigraduatebe.graduation.domain.model.GraduationCategory.CORE_CULTURE; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import com.plzgraduate.myongjigraduatebe.graduation.domain.model.DetailCategoryResult; +import com.plzgraduate.myongjigraduatebe.graduation.domain.model.DetailGraduationResult; +import com.plzgraduate.myongjigraduatebe.graduation.domain.service.GraduationManager; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.TakenLecture; +import com.plzgraduate.myongjigraduatebe.user.domain.model.StudentInformation; + +public class CoreCultureGraduationManager implements GraduationManager { + @Override + public DetailGraduationResult createDetailGraduationResult(StudentInformation studentInformation, + Set takenLectures, Set graduationLectures, int coreCultureGraduationTotalCredit) { + CoreCultureDetailCategoryManager coreCultureDetailCategoryManager = new CoreCultureDetailCategoryManager(); + List coreCultureDetailCategoryResults = Arrays.stream(CoreCultureCategory.values()) + .map(coreCultureCategory -> coreCultureDetailCategoryManager.generate(studentInformation, takenLectures, + graduationLectures, coreCultureCategory)) + .collect(Collectors.toList()); + + return DetailGraduationResult.create(CORE_CULTURE, coreCultureGraduationTotalCredit, + coreCultureDetailCategoryResults); + } +} diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCulture.java b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCulture.java new file mode 100644 index 00000000..8208c763 --- /dev/null +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCulture.java @@ -0,0 +1,23 @@ +package com.plzgraduate.myongjigraduatebe.lecture.domain.model; + +import lombok.Builder; +import lombok.Getter; + +@Getter +public class CoreCulture { + + private Lecture lecture; + private CoreCultureCategory coreCultureCategory; + + @Builder + private CoreCulture(Lecture lecture, CoreCultureCategory coreCultureCategory) { + this.lecture = lecture; + this.coreCultureCategory = coreCultureCategory; + } + + public static CoreCulture of(Lecture lecture, CoreCultureCategory category) { + return CoreCulture.builder() + .lecture(lecture) + .coreCultureCategory(category).build(); + } +} diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCultureCategory.java b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCultureCategory.java new file mode 100644 index 00000000..6b86b3f4 --- /dev/null +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/CoreCultureCategory.java @@ -0,0 +1,18 @@ +package com.plzgraduate.myongjigraduatebe.lecture.domain.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum CoreCultureCategory { + + HISTORY_PHILOSOPHY("역사와철학", 3), + SOCIETY_COMMUNITY("사회와공동체", 3), + CULTURE_ART("문화와예술", 3), + SCIENCE_TECHNOLOGY("과학과기술", 3); + + private final String name; + private final int totalCredit; + +} diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/Lecture.java b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/Lecture.java index 00b9794f..ec8f5af8 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/Lecture.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/domain/model/Lecture.java @@ -23,6 +23,12 @@ private Lecture(String lectureCode, String name, int credit, int isRevoked, Stri this.duplicateCode = duplicateCode; } + public static Lecture from(String lectureCode) { + return Lecture.builder(). + lectureCode(lectureCode) + .build(); + } + public static Lecture of(String lectureCode, String name, int credit, int isRevoked, String duplicateCode) { return Lecture.builder() .lectureCode(lectureCode) diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureCategoryFixture.java b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureCategoryFixture.java new file mode 100644 index 00000000..697cb674 --- /dev/null +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureCategoryFixture.java @@ -0,0 +1,28 @@ +package com.plzgraduate.myongjigraduatebe.fixture; + +import static com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture.핵심교양_과학과기술; +import static com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture.핵심교양_문화와예술; +import static com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture.핵심교양_사회와공동체; +import static com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture.핵심교양_역사와철학; +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.*; + +import java.util.Map; +import java.util.stream.Stream; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; + + +public class CoreCultureCategoryFixture implements ArgumentsProvider { + + @Override + public Stream provideArguments(ExtensionContext context) throws Exception { + return Stream.of( + Arguments.arguments(HISTORY_PHILOSOPHY,핵심교양_역사와철학()), + Arguments.arguments(SOCIETY_COMMUNITY, 핵심교양_사회와공동체()), + Arguments.arguments(CULTURE_ART, 핵심교양_문화와예술()), + Arguments.arguments(SCIENCE_TECHNOLOGY, 핵심교양_과학과기술()) + ); + } +} diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureFixture.java b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureFixture.java new file mode 100644 index 00000000..9bff5fea --- /dev/null +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/CoreCultureFixture.java @@ -0,0 +1,71 @@ +package com.plzgraduate.myongjigraduatebe.fixture; + +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.CULTURE_ART; +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.HISTORY_PHILOSOPHY; +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.SCIENCE_TECHNOLOGY; +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.SOCIETY_COMMUNITY; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + + +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.Lecture; + +public class CoreCultureFixture { + + public static final Map mockLectureMap = LectureFixture.getMockLectureMap(); + + public static Set getAllCoreCulture() { + Set coreCultures = new HashSet<>(); + coreCultures.addAll(핵심교양_역사와철학()); + coreCultures.addAll(핵심교양_사회와공동체()); + coreCultures.addAll(핵심교양_문화와예술()); + coreCultures.addAll(핵심교양_과학과기술()); + return coreCultures; + } + + public static Set 핵심교양_역사와철학() { + Set lectureSet = new HashSet<>(); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02110"), HISTORY_PHILOSOPHY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02111"), HISTORY_PHILOSOPHY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02112"), HISTORY_PHILOSOPHY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02140"), HISTORY_PHILOSOPHY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02158"), HISTORY_PHILOSOPHY)); + return lectureSet; + } + + public static Set 핵심교양_사회와공동체() { + Set lectureSet = new HashSet<>(); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02113"), SOCIETY_COMMUNITY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02114"), SOCIETY_COMMUNITY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02131"), SOCIETY_COMMUNITY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02142"), SOCIETY_COMMUNITY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02160"), SOCIETY_COMMUNITY)); + return lectureSet; + } + + public static Set 핵심교양_문화와예술() { + Set lectureSet = new HashSet<>(); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02128"), CULTURE_ART)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02130"), CULTURE_ART)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02132"), CULTURE_ART)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02155"), CULTURE_ART)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02156"), CULTURE_ART)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02159"), CULTURE_ART)); + return lectureSet; + } + + public static Set 핵심교양_과학과기술() { + Set lectureSet = new HashSet<>(); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02119"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02120"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02127"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02135"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02136"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02138"), SCIENCE_TECHNOLOGY)); + lectureSet.add(CoreCulture.of(mockLectureMap.get("KMA02139"), SCIENCE_TECHNOLOGY)); + return lectureSet; + } +} diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/UserFixture.java b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/UserFixture.java index 2f99afe1..43a224eb 100644 --- a/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/UserFixture.java +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/fixture/UserFixture.java @@ -42,4 +42,19 @@ public class UserFixture { return User.create("mj22", "1234", EnglishLevel.ENG34, "김경영", 60231022, studentInformation); } + public static User 응용소프트웨어학과_19학번() { + StudentInformation studentInformation = StudentInformation.of(19, "응용소프트웨어학과", StudentCategory.NORMAL); + return User.create("mj22", "1234", EnglishLevel.ENG34, "김응용", 60191022, studentInformation); + } + + public static User 데이터테크놀로지학과_19학번() { + StudentInformation studentInformation = StudentInformation.of(19, "응용소프트웨어학과", StudentCategory.NORMAL); + return User.create("mj22", "1234", EnglishLevel.ENG34, "김응용", 60191022, studentInformation); + } + + public static User 디지털콘텐츠디자인학과_19학번() { + StudentInformation studentInformation = StudentInformation.of(19, "응용소프트웨어학과", StudentCategory.NORMAL); + return User.create("mj22", "1234", EnglishLevel.ENG34, "김응용", 60191022, studentInformation); + } + } diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManagerTest.java b/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManagerTest.java new file mode 100644 index 00000000..cbe68fb7 --- /dev/null +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureDetailCategoryManagerTest.java @@ -0,0 +1,158 @@ +package com.plzgraduate.myongjigraduatebe.graduation.domain.service.coreculture; + +import static com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture.*; +import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.*; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsSource; +import org.junit.jupiter.params.provider.MethodSource; + +import com.plzgraduate.myongjigraduatebe.fixture.CoreCultureCategoryFixture; +import com.plzgraduate.myongjigraduatebe.fixture.LectureFixture; +import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; +import com.plzgraduate.myongjigraduatebe.graduation.domain.model.DetailCategoryResult; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.Lecture; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.Semester; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.TakenLecture; +import com.plzgraduate.myongjigraduatebe.user.domain.model.User; + +@DisplayName("각 핵심교양 세부 카테고리 별 카테고리 이름, 총 학점, 이수 여부를 포함한 카테고리 졸업 결과를 생성한다.") +class CoreCultureDetailCategoryManagerTest { + + Map mockLectureMap = LectureFixture.getMockLectureMap(); + CoreCultureDetailCategoryManager manager = new CoreCultureDetailCategoryManager(); + + @DisplayName("각 카테고리의 해당하는 과목의 이수 학점을 만족한 경우 이수 완료의 카테고리 졸업 결과를 생성한다.") + @ParameterizedTest + @ArgumentsSource(CoreCultureCategoryFixture.class) + void generateCompletedCoreCultureDetailCategoryResult(CoreCultureCategory coreCultureCategory, + Set graduationLectures) { + //given + User user = UserFixture.경영학과_19학번(); + Set takenLectures = new HashSet<>((Set.of( + TakenLecture.of(user, mockLectureMap.get("KMA02110"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02111"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02112"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02140"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02158"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02113"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02114"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02131"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02142"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02160"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02128"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02130"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02132"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02155"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02156"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02159"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02119"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02120"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02127"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02135"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02136"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02138"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02139"), 2023, Semester.FIRST) + ))); + String coreCultureCategoryName = coreCultureCategory.getName(); + int categoryTotalCredit = coreCultureCategory.getTotalCredit(); + + //when + DetailCategoryResult detailCategoryResult = manager.generate(user.getStudentInformation(), takenLectures, + graduationLectures, + coreCultureCategory); + + //then + assertThat(detailCategoryResult) + .extracting("detailCategoryName", "isCompleted", "totalCredits") + .contains(coreCultureCategoryName, true, categoryTotalCredit); + } + + @DisplayName("각 카테고리의 해당하는 과목의 이수 학점을 만족하지 못한 경우 이수 미 완료의 카테고리 졸업 결과를 생성한다.") + @ParameterizedTest + @ArgumentsSource(CoreCultureCategoryFixture.class) + void generateUnCompletedCoreCultureDetailCategoryResult(CoreCultureCategory coreCultureCategory, + Set graduationLectures) { + //given + User user = UserFixture.경영학과_19학번(); + Set takenLectures = new HashSet<>(); + String coreCultureCategoryName = coreCultureCategory.getName(); + int categoryTotalCredit = coreCultureCategory.getTotalCredit(); + + //when + DetailCategoryResult detailCategoryResult = manager.generate(user.getStudentInformation(), takenLectures, + graduationLectures, coreCultureCategory); + + //then + assertThat(detailCategoryResult) + .extracting("detailCategoryName", "isCompleted", "totalCredits") + .contains(coreCultureCategoryName, false, categoryTotalCredit); + } + + @DisplayName("ICT학부 전공 학생은 핵심교양 세부 카테고리 '과학과기술' 중 SW프로그래밍입문을 수강했을 경우 카테고리 수강 학점이 아닌 자유학점으로 인정된다.") + @ParameterizedTest + @MethodSource("ictUsers") + void generateUnCompletedScienceTechnologyDetailCategoryResultWithICT(User user) { + //given + Set takenLectures = new HashSet<>((Set.of( + TakenLecture.of(user, mockLectureMap.get("KMA02135"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02136"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02138"), 2019, Semester.FIRST) + ))); + Set graduationLectures = 핵심교양_과학과기술(); + CoreCultureCategory coreCultureCategory = SCIENCE_TECHNOLOGY; + int categoryTotalCredit = coreCultureCategory.getTotalCredit(); + + //when + DetailCategoryResult detailCategoryResult = manager.generate(user.getStudentInformation(), takenLectures, + graduationLectures, coreCultureCategory); + + //then + assertThat(detailCategoryResult) + .extracting("detailCategoryName", "isCompleted", "totalCredits", "normalLeftCredit", + "freeElectiveLeftCredit") + .contains(coreCultureCategory.getName(), true, categoryTotalCredit, 3, 3); + } + static Stream ictUsers() { + return Stream.of( + Arguments.arguments(UserFixture.응용소프트웨어학과_19학번()), + Arguments.arguments(UserFixture.데이터테크놀로지학과_19학번()), + Arguments.arguments(UserFixture.디지털콘텐츠디자인학과_19학번()) + ); + } + + @DisplayName("4차산업혁명시대의예술, 문화리터러시와창의적스토리텔링 과목은 2022년 1학기에 수강한 경우에는 핵심교양이 아닌 일반교양으로 인정된다.") + @Test + void generateUnCompletedCultureArtDetailCategoryResultWith_2022_First() { + //given + User user = UserFixture.경영학과_19학번(); + Set takenLectures = new HashSet<>((Set.of( + TakenLecture.of(user, mockLectureMap.get("KMA02155"), 2022, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02156"), 2022, Semester.FIRST) + ))); + Set graduationLectures = 핵심교양_문화와예술(); + CoreCultureCategory coreCultureCategory = CULTURE_ART; + int categoryTotalCredit = coreCultureCategory.getTotalCredit(); + + //when + DetailCategoryResult detailCategoryResult = manager.generate(user.getStudentInformation(), takenLectures, + graduationLectures, coreCultureCategory); + + //then + assertThat(detailCategoryResult) + .extracting("detailCategoryName", "isCompleted", "totalCredits", "normalLeftCredit", + "freeElectiveLeftCredit") + .contains(coreCultureCategory.getName(), false, categoryTotalCredit, 6, 0); + } +} diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManagerTest.java b/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManagerTest.java new file mode 100644 index 00000000..5bbc92cc --- /dev/null +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/graduation/domain/service/coreculture/CoreCultureGraduationManagerTest.java @@ -0,0 +1,103 @@ +package com.plzgraduate.myongjigraduatebe.graduation.domain.service.coreculture; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import com.plzgraduate.myongjigraduatebe.fixture.CoreCultureFixture; +import com.plzgraduate.myongjigraduatebe.fixture.LectureFixture; +import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; +import com.plzgraduate.myongjigraduatebe.graduation.domain.model.DetailGraduationResult; +import com.plzgraduate.myongjigraduatebe.graduation.domain.service.GraduationManager; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; +import com.plzgraduate.myongjigraduatebe.lecture.domain.model.Lecture; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.Semester; +import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.TakenLecture; +import com.plzgraduate.myongjigraduatebe.user.domain.model.StudentInformation; +import com.plzgraduate.myongjigraduatebe.user.domain.model.User; + +@DisplayName("각 핵심교양 세부 카테고리 졸업 결과를 포함한 공통교양 전체 졸업 결과를 생성한다.") +class CoreCultureGraduationManagerTest { + + Map mockLectureMap = LectureFixture.getMockLectureMap(); + GraduationManager graduationManager = new CoreCultureGraduationManager(); + + @DisplayName("모든 핵심교양 세부 카테고리가 이수 완료일 경우 이수 완료 핵심교양 전체 졸업 결과를 생성한다.") + @Test + void generateCompletedDetailGraduationResult() { + //given + User user = UserFixture.영문학과_16학번(); + Set takenLectures = new HashSet<>((Set.of( + TakenLecture.of(user, mockLectureMap.get("KMA02110"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02111"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02112"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02140"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02158"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02113"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02114"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02131"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02142"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02160"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02128"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02130"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02132"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02155"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02156"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02159"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02119"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02120"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02127"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02135"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02136"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02138"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02139"), 2023, Semester.FIRST) + ))); + StudentInformation studentInformation = user.getStudentInformation(); + Set graduationLectures = CoreCultureFixture.getAllCoreCulture(); + + //when + DetailGraduationResult detailGraduationResult = graduationManager.createDetailGraduationResult( + studentInformation, takenLectures, graduationLectures, 12); + + //then + assertThat(detailGraduationResult) + .extracting("categoryName", "isCompleted") + .contains("핵심교양", true); + } + + @DisplayName("모든 핵심교양 세부 카테고리가 이수 완료가 아닐 경우 이수 미 완료 핵심교양 전체 졸업 결과를 생성한다.") + @Test + void generateUnCompletedDetailGraduationResult() { + //given + User user = UserFixture.영문학과_16학번(); + StudentInformation studentInformation = user.getStudentInformation(); + Set takenLectures = new HashSet<>((Set.of( + TakenLecture.of(user, mockLectureMap.get("KMA02110"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02111"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02112"), 2019, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02140"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02158"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02113"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02114"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02131"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02142"), 2023, Semester.FIRST), + TakenLecture.of(user, mockLectureMap.get("KMA02160"), 2023, Semester.FIRST) + ))); + + Set graduationLectures = CoreCultureFixture.getAllCoreCulture(); + + //when + DetailGraduationResult detailGraduationResult = graduationManager.createDetailGraduationResult( + studentInformation, takenLectures, graduationLectures, 12); + //then + assertThat(detailGraduationResult) + .extracting("categoryName", "isCompleted") + .contains("핵심교양", false); + } + +} diff --git a/src/test/resources/lecture.csv b/src/test/resources/lecture.csv index 53644005..920a8787 100644 --- a/src/test/resources/lecture.csv +++ b/src/test/resources/lecture.csv @@ -18,6 +18,29 @@ KMA02126, 영어회화4, 1, 0, null KMA02137, 4차산업혁명시대의진로선택, 2, 1, null KMA02141, 4차산업혁명과미래사회진로선택, 2, 0, KMA02137 KMA02157, 디지털리터러시의이해, 2, 0, null +KMA02110, 철학과인간, 3, 0, null +KMA02111, 한국근현대사의이해, 3, 0, null +KMA02112, 역사와문명, 3, 0, null +KMA02140, 4차산업혁명을위한비판적사고, 3, 0, null +KMA02158, 디지털콘텐츠로만나는한국의문화유산, 3, 0, null +KMA02113, 세계화와사회변화, 3, 0, null +KMA02114, 민주주의와현대사회, 3, 0, null +KMA02131, 여성소수자공동체, 3, 0, null +KMA02142, 현대사회와심리학, 3, 0, null +KMA02160, 직무수행과전략적의사소통, 3, 0, null +KMA02128, 글로벌문화, 3, 0, null +KMA02130, 고전으로읽는인문학, 3, 0, null +KMA02132, 예술과창조성, 3, 0, null +KMA02155, 4차산업혁명시대의예술, 3, 0, null +KMA02156, 문화리터러시와창의적스토리텔링, 3, 0, null +KMA02159, 디지털문화의이해, 3, 0, null +KMA02119, 첨단과학의이해, 3, 1, null +KMA02120, 환경과인간, 3, 0, null +KMA02127, 창업입문, 3, 0, null +KMA02135, 우주생명마음, 3, 0, KMA02119 +KMA02136, SW프로그래밍입문, 3, 0, null +KMA02138, 인공지능의세계, 3, 0, null +KMA02139, 4차산업혁명의이해, 3, 0, null KMB02127, 한국문화와문자생활, 3, 0, null KMB02119, 영어와영미문화, 3, 1, null KMB02120, 아랍의언어와문화, 3, 0, null