-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...ebe/lecture/adapter/out/persistence/FindBasicAcademicalCulturePersistenceAdapterTest.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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence; | ||
|
||
import static com.plzgraduate.myongjigraduatebe.user.domain.model.College.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.BasicAcademicalCultureLectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.LectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.BasicAcademicalCultureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.LectureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.domain.model.BasicAcademicalCultureLecture; | ||
import com.plzgraduate.myongjigraduatebe.support.PersistenceTestSupport; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
@Import({LectureMapper.class, FindBasicAcademicalCulturePersistenceAdapter.class}) | ||
class FindBasicAcademicalCulturePersistenceAdapterTest extends PersistenceTestSupport { | ||
|
||
@Autowired | ||
private LectureRepository lectureRepository; | ||
@Autowired | ||
private BasicAcademicalCultureRepository basicAcademicalCultureRepository; | ||
@Autowired | ||
private FindBasicAcademicalCulturePersistenceAdapter basicAcademicalCulturePersistenceAdapter; | ||
|
||
@DisplayName("유저의 단과대에 속하는 학문기초교양 과목들을 반환한다.") | ||
@Test | ||
void findBasicAcademicalCulture() { | ||
//given | ||
User user = UserFixture.응용소프트웨어학과_19학번(); | ||
LectureJpaEntity lectureJpaEntityA = LectureJpaEntity.builder() | ||
.lectureCode("testA") | ||
.build(); | ||
LectureJpaEntity lectureJpaEntityB = LectureJpaEntity.builder() | ||
.lectureCode("testB") | ||
.build(); | ||
lectureRepository.saveAll(List.of(lectureJpaEntityA, lectureJpaEntityB)); | ||
|
||
BasicAcademicalCultureLectureJpaEntity basicAcademicalCultureLectureJpaEntityA = BasicAcademicalCultureLectureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.college(ICT.getText()).build(); | ||
|
||
BasicAcademicalCultureLectureJpaEntity basicAcademicalCultureLectureJpaEntityB = BasicAcademicalCultureLectureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.college(BUSINESS.getText()).build(); | ||
basicAcademicalCultureRepository.saveAll( | ||
List.of(basicAcademicalCultureLectureJpaEntityA, basicAcademicalCultureLectureJpaEntityB)); | ||
|
||
//when | ||
Set<BasicAcademicalCultureLecture> basicAcademicalCulture = basicAcademicalCulturePersistenceAdapter.findBasicAcademicalCulture( | ||
user); | ||
//then | ||
assertThat(basicAcademicalCulture).hasSize(1) | ||
.extracting("college") | ||
.contains(ICT.getText()); | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
...jigraduatebe/lecture/adapter/out/persistence/FindCommonCulturePersistenceAdapterTest.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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence; | ||
|
||
import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CommonCultureCategory.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.CommonCultureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.LectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.CommonCultureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.LectureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CommonCulture; | ||
import com.plzgraduate.myongjigraduatebe.support.PersistenceTestSupport; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
@Import({LectureMapper.class, FindCommonCulturePersistenceAdapter.class}) | ||
class FindCommonCulturePersistenceAdapterTest extends PersistenceTestSupport { | ||
|
||
@Autowired | ||
private LectureRepository lectureRepository; | ||
@Autowired | ||
private CommonCultureRepository commonCultureRepository; | ||
@Autowired | ||
private FindCommonCulturePersistenceAdapter commonCulturePersistenceAdapter; | ||
|
||
@DisplayName("유저의 입학년도에 해당하는 공통교양과목들을 조회한다.") | ||
@Test | ||
void findCommonCulture() { | ||
//given | ||
User user = UserFixture.응용소프트웨어학과_19학번(); | ||
LectureJpaEntity lectureJpaEntityA = LectureJpaEntity.builder() | ||
.lectureCode("testA") | ||
.build(); | ||
LectureJpaEntity lectureJpaEntityB = LectureJpaEntity.builder() | ||
.lectureCode("testB") | ||
.build(); | ||
lectureRepository.saveAll(List.of(lectureJpaEntityA, lectureJpaEntityB)); | ||
|
||
CommonCultureJpaEntity commonCultureJpaEntityA = CommonCultureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.commonCultureCategory(CAREER) | ||
.startEntryYear(16) | ||
.endEntryYear(18).build(); | ||
CommonCultureJpaEntity commonCultureJpaEntityB = CommonCultureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityB) | ||
.commonCultureCategory(EXPRESSION) | ||
.startEntryYear(19) | ||
.endEntryYear(23).build(); | ||
commonCultureRepository.saveAll(List.of(commonCultureJpaEntityA, commonCultureJpaEntityB)); | ||
|
||
//when | ||
Set<CommonCulture> commonCultures = commonCulturePersistenceAdapter.findCommonCulture(user); | ||
|
||
//then | ||
assertThat(commonCultures).hasSize(1) | ||
.extracting("commonCultureCategory") | ||
.contains(EXPRESSION); | ||
} | ||
|
||
} |
71 changes: 71 additions & 0 deletions
71
...ngjigraduatebe/lecture/adapter/out/persistence/FindCoreCulturePersistenceAdapterTest.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence; | ||
|
||
import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CommonCultureCategory.CAREER; | ||
import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CommonCultureCategory.EXPRESSION; | ||
import static com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCultureCategory.*; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.CoreCultureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.LectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.CoreCultureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.LectureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.domain.model.CoreCulture; | ||
import com.plzgraduate.myongjigraduatebe.support.PersistenceTestSupport; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
@Import({LectureMapper.class, FindCoreCulturePersistenceAdapter.class}) | ||
class FindCoreCulturePersistenceAdapterTest extends PersistenceTestSupport { | ||
|
||
@Autowired | ||
private LectureRepository lectureRepository; | ||
@Autowired | ||
private CoreCultureRepository coreCultureRepository; | ||
@Autowired | ||
private FindCoreCulturePersistenceAdapter coreCulturePersistenceAdapter; | ||
|
||
|
||
@DisplayName("유저의 입학년도에 해당하는 핵심교양과목들을 조회한다.") | ||
@Test | ||
void findCoreCulture() { | ||
//given | ||
User user = UserFixture.응용소프트웨어학과_19학번(); | ||
LectureJpaEntity lectureJpaEntityA = LectureJpaEntity.builder() | ||
.lectureCode("testA") | ||
.build(); | ||
LectureJpaEntity lectureJpaEntityB = LectureJpaEntity.builder() | ||
.lectureCode("testB") | ||
.build(); | ||
lectureRepository.saveAll(List.of(lectureJpaEntityA, lectureJpaEntityB)); | ||
|
||
CoreCultureJpaEntity coreCultureJpaEntityA = CoreCultureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.coreCultureCategory(CULTURE_ART) | ||
.startEntryYear(16) | ||
.endEntryYear(18).build(); | ||
CoreCultureJpaEntity coreCultureJpaEntityB = CoreCultureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.coreCultureCategory(SOCIETY_COMMUNITY) | ||
.startEntryYear(19) | ||
.endEntryYear(23).build(); | ||
coreCultureRepository.saveAll(List.of(coreCultureJpaEntityA, coreCultureJpaEntityB)); | ||
|
||
//when | ||
Set<CoreCulture> commonCultures = coreCulturePersistenceAdapter.findCoreCulture(user); | ||
|
||
//then | ||
assertThat(commonCultures).hasSize(1) | ||
.extracting("coreCultureCategory") | ||
.contains(SOCIETY_COMMUNITY); | ||
|
||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...te/myongjigraduatebe/lecture/adapter/out/persistence/FindMajorPersistenceAdapterTest.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import com.plzgraduate.myongjigraduatebe.fixture.UserFixture; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.LectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.MajorLectureJpaEntity; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.LectureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.MajorLectureRepository; | ||
import com.plzgraduate.myongjigraduatebe.lecture.domain.model.MajorLecture; | ||
import com.plzgraduate.myongjigraduatebe.support.PersistenceTestSupport; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
@Import({LectureMapper.class, FindMajorPersistenceAdapter.class}) | ||
class FindMajorPersistenceAdapterTest extends PersistenceTestSupport { | ||
|
||
@Autowired | ||
private LectureRepository lectureRepository; | ||
@Autowired | ||
private MajorLectureRepository majorLectureRepository; | ||
@Autowired | ||
private FindMajorPersistenceAdapter majorPersistenceAdapter; | ||
|
||
@DisplayName("유저의 전공에 해당하는 전공 과목을 조회한다.") | ||
@Test | ||
void findMajor() { | ||
//given | ||
User user = UserFixture.응용소프트웨어학과_19학번(); | ||
LectureJpaEntity lectureJpaEntityA = LectureJpaEntity.builder() | ||
.lectureCode("testA") | ||
.build(); | ||
LectureJpaEntity lectureJpaEntityB = LectureJpaEntity.builder() | ||
.lectureCode("testB") | ||
.build(); | ||
lectureRepository.saveAll(List.of(lectureJpaEntityA, lectureJpaEntityB)); | ||
|
||
MajorLectureJpaEntity majorLectureJpaEntityA = MajorLectureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.major(user.getMajor()).build(); | ||
|
||
MajorLectureJpaEntity majorLectureJpaEntityB = MajorLectureJpaEntity.builder() | ||
.lectureJpaEntity(lectureJpaEntityA) | ||
.major("데이터테크놀로지").build(); | ||
majorLectureRepository.saveAll(List.of(majorLectureJpaEntityA, majorLectureJpaEntityB)); | ||
|
||
//when | ||
Set<MajorLecture> majors = majorPersistenceAdapter.findMajor(user); | ||
|
||
//then | ||
assertThat(majors).hasSize(1) | ||
.extracting("major") | ||
.contains(user.getMajor()); | ||
} | ||
|
||
} |