From fc236a47a55390313b1933b3d6586168cd43f6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=9B=90=EA=B2=BD?= Date: Sat, 21 Dec 2024 16:52:30 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../koin/acceptance/SemesterApiTest.java | 38 ++-- .../koin/acceptance/TimetableApiTest.java | 24 +-- .../acceptance/TimetableFrameApiTest.java | 6 +- .../acceptance/TimetableLectureApiTest.java | 2 +- .../koin/fixture/SemesterFixture.java | 188 ++++++++++++++++-- 5 files changed, 204 insertions(+), 54 deletions(-) diff --git a/src/test/java/in/koreatech/koin/acceptance/SemesterApiTest.java b/src/test/java/in/koreatech/koin/acceptance/SemesterApiTest.java index 7caa530f3..5ae89e051 100644 --- a/src/test/java/in/koreatech/koin/acceptance/SemesterApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/SemesterApiTest.java @@ -44,13 +44,13 @@ void setup() { @Test void 모든_학기를_조회한다() throws Exception { - semesterFixture.semester("20241"); - semesterFixture.semester("20242"); - semesterFixture.semester("2024-여름"); - semesterFixture.semester("20231"); - semesterFixture.semester("20232"); - semesterFixture.semester("2023-여름"); - semesterFixture.semester("2023-겨울"); + semesterFixture.semester_2024년도_1학기(); + semesterFixture.semester_2024년도_2학기(); + semesterFixture.semester_2024년도_여름(); + semesterFixture.semester_2023년도_1학기(); + semesterFixture.semester_2023년도_2학기(); + semesterFixture.semester_2023년도_여름(); + semesterFixture.semester_2023년도_겨울(); mockMvc.perform( get("/semesters") @@ -95,8 +95,8 @@ void setup() { void 학생이_가진_시간표의_학기를_조회한다() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester1 = semesterFixture.semester("20192"); - Semester semester2 = semesterFixture.semester("20201"); + Semester semester1 = semesterFixture.semester_2019년도_2학기(); + Semester semester2 = semesterFixture.semester_2020년도_1학기(); Lecture HRD_개론 = lectureFixture.HRD_개론(semester1.getSemester()); Lecture 건축구조의_이해_및_실습 = lectureFixture.건축구조의_이해_및_실습(semester2.getSemester()); timetableV2Fixture.시간표6(user, semester1, HRD_개론, null); @@ -121,14 +121,14 @@ void setup() { @Test void 모든_학기를_조회한다_V3() throws Exception { - semesterFixture.semesterV3_2019년도_1학기(); - semesterFixture.semesterV3_2019년도_2학기(); - semesterFixture.semesterV3_2019년도_여름(); - semesterFixture.semesterV3_2019년도_겨울(); - semesterFixture.semesterV3_2020년도_1학기(); - semesterFixture.semesterV3_2020년도_2학기(); - semesterFixture.semesterV3_2020년도_여름(); - semesterFixture.semesterV3_2020년도_겨울(); + semesterFixture.semester_2019년도_1학기(); + semesterFixture.semester_2019년도_2학기(); + semesterFixture.semester_2019년도_여름(); + semesterFixture.semester_2019년도_겨울(); + semesterFixture.semester_2020년도_1학기(); + semesterFixture.semester_2020년도_2학기(); + semesterFixture.semester_2020년도_여름(); + semesterFixture.semester_2020년도_겨울(); mockMvc.perform( get("/v3/semesters") @@ -177,8 +177,8 @@ void setup() { void 학생이_가진_시간표의_학기를_조회한다_V3() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester1 = semesterFixture.semesterV3_2019년도_2학기(); - Semester semester2 = semesterFixture.semesterV3_2020년도_1학기(); + Semester semester1 = semesterFixture.semester_2019년도_2학기(); + Semester semester2 = semesterFixture.semester_2020년도_1학기(); Lecture HRD_개론 = lectureFixture.HRD_개론(semester1.getSemester()); Lecture 건축구조의_이해_및_실습 = lectureFixture.건축구조의_이해_및_실습(semester2.getSemester()); timetableV2Fixture.시간표6(user, semester1, HRD_개론, null); diff --git a/src/test/java/in/koreatech/koin/acceptance/TimetableApiTest.java b/src/test/java/in/koreatech/koin/acceptance/TimetableApiTest.java index 43a9db440..45c1ddfc4 100644 --- a/src/test/java/in/koreatech/koin/acceptance/TimetableApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/TimetableApiTest.java @@ -48,8 +48,8 @@ void setup() { @Test void 특정_학기_강의를_조회한다() throws Exception { - semesterFixture.semester("20192"); - semesterFixture.semester("20201"); + semesterFixture.semester_2019년도_2학기(); + semesterFixture.semester_2020년도_1학기(); String semester = "20201"; lectureFixture.HRD_개론(semester); lectureFixture.건축구조의_이해_및_실습("20192"); @@ -85,7 +85,7 @@ void setup() { @Test void 특정_학기_강의들을_조회한다() throws Exception { - semesterFixture.semester("20201"); + semesterFixture.semester_2020년도_1학기(); String semester = "20201"; lectureFixture.HRD_개론(semester); lectureFixture.건축구조의_이해_및_실습(semester); @@ -170,10 +170,10 @@ void setup() { @Test void 계절학기를_조회하면_빈_리스트로_반환한다() throws Exception { - semesterFixture.semester("20241"); - semesterFixture.semester("20242"); - semesterFixture.semester("2024-여름"); - semesterFixture.semester("2024-겨울"); + semesterFixture.semester_2024년도_1학기(); + semesterFixture.semester_2024년도_2학기(); + semesterFixture.semester_2024년도_여름(); + semesterFixture.semester_2024년도_겨울(); mockMvc.perform( get("/lectures") @@ -188,7 +188,7 @@ void setup() { void 시간표를_조회한다() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester = semesterFixture.semester("20192"); + Semester semester = semesterFixture.semester_2019년도_2학기(); Lecture 건축구조의_이해_및_실습 = lectureFixture.건축구조의_이해_및_실습(semester.getSemester()); Lecture HRD_개론 = lectureFixture.HRD_개론(semester.getSemester()); @@ -247,7 +247,7 @@ void setup() { void 시간표를_조회한다_시간표_프레임_없으면_생성() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester = semesterFixture.semester("20192"); + Semester semester = semesterFixture.semester_2019년도_2학기(); mockMvc.perform( get("/timetables") @@ -271,7 +271,7 @@ void setup() { void 시간표를_생성한다() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester = semesterFixture.semester("20192"); + Semester semester = semesterFixture.semester_2019년도_2학기(); lectureFixture.건축구조의_이해_및_실습(semester.getSemester()); lectureFixture.HRD_개론(semester.getSemester()); @@ -364,7 +364,7 @@ void setup() { void 시간표를_단일_생성한다_전체_반환() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester = semesterFixture.semester("20192"); + Semester semester = semesterFixture.semester_2019년도_2학기(); lectureFixture.건축구조의_이해_및_실습(semester.getSemester()); lectureFixture.HRD_개론(semester.getSemester()); @@ -471,7 +471,7 @@ void setup() { void 시간표를_삭제한다() throws Exception { User user = userFixture.준호_학생().getUser(); String token = userFixture.getToken(user); - Semester semester = semesterFixture.semester("20192"); + Semester semester = semesterFixture.semester_2019년도_2학기(); Lecture 건축구조의_이해_및_실습 = lectureFixture.건축구조의_이해_및_실습(semester.getSemester()); Lecture HRD_개론 = lectureFixture.HRD_개론(semester.getSemester()); diff --git a/src/test/java/in/koreatech/koin/acceptance/TimetableFrameApiTest.java b/src/test/java/in/koreatech/koin/acceptance/TimetableFrameApiTest.java index 0a66b6e6f..8eacc566c 100644 --- a/src/test/java/in/koreatech/koin/acceptance/TimetableFrameApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/TimetableFrameApiTest.java @@ -57,7 +57,7 @@ void setup() { clear(); user = userFixture.준호_학생().getUser(); token = userFixture.getToken(user); - semester = semesterFixture.semester("20192"); + semester = semesterFixture.semester_2019년도_2학기(); } @Test @@ -236,8 +236,8 @@ void setup() { @Test void 모든_학기의_시간표_프레임을_조회한다() throws Exception { - Semester semester1 = semesterFixture.semester("20241"); - Semester semester2 = semesterFixture.semester("20242"); + Semester semester1 = semesterFixture.semester_2024년도_1학기(); + Semester semester2 = semesterFixture.semester_2024년도_2학기(); timetableV2Fixture.시간표1(user, semester1); timetableV2Fixture.시간표2(user, semester1); diff --git a/src/test/java/in/koreatech/koin/acceptance/TimetableLectureApiTest.java b/src/test/java/in/koreatech/koin/acceptance/TimetableLectureApiTest.java index 8f8883f8f..2fae83d8e 100644 --- a/src/test/java/in/koreatech/koin/acceptance/TimetableLectureApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/TimetableLectureApiTest.java @@ -51,7 +51,7 @@ void setup() { clear(); user = userFixture.준호_학생().getUser(); token = userFixture.getToken(user); - semester = semesterFixture.semester("20192"); + semester = semesterFixture.semester_2019년도_2학기(); } @Test diff --git a/src/test/java/in/koreatech/koin/fixture/SemesterFixture.java b/src/test/java/in/koreatech/koin/fixture/SemesterFixture.java index f8ffb0487..8098e8210 100644 --- a/src/test/java/in/koreatech/koin/fixture/SemesterFixture.java +++ b/src/test/java/in/koreatech/koin/fixture/SemesterFixture.java @@ -11,23 +11,13 @@ @SuppressWarnings("NonAsciiCharacters") public class SemesterFixture { - private final SemesterRepository semesterRepository; private final SemesterRepositoryV3 semesterRepositoryV3; - public SemesterFixture(SemesterRepository semesterRepository, SemesterRepositoryV3 semesterRepositoryV3) { - this.semesterRepository = semesterRepository; + public SemesterFixture(SemesterRepositoryV3 semesterRepositoryV3) { this.semesterRepositoryV3 = semesterRepositoryV3; } - public Semester semester(String semester) { - return semesterRepository.save( - Semester.builder() - .semester(semester) - .build() - ); - } - - public Semester semesterV3_2019년도_1학기() { + public Semester semester_2019년도_1학기() { return semesterRepositoryV3.save( Semester.builder() .semester("20191") @@ -37,7 +27,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2019년도_2학기() { + public Semester semester_2019년도_2학기() { return semesterRepositoryV3.save( Semester.builder() .semester("20192") @@ -47,7 +37,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2019년도_여름() { + public Semester semester_2019년도_여름() { return semesterRepositoryV3.save( Semester.builder() .semester("2019-여름") @@ -57,7 +47,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2019년도_겨울() { + public Semester semester_2019년도_겨울() { return semesterRepositoryV3.save( Semester.builder() .semester("2019-겨울") @@ -67,7 +57,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2020년도_1학기() { + public Semester semester_2020년도_1학기() { return semesterRepositoryV3.save( Semester.builder() .semester("20201") @@ -77,7 +67,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2020년도_2학기() { + public Semester semester_2020년도_2학기() { return semesterRepositoryV3.save( Semester.builder() .semester("20202") @@ -87,7 +77,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2020년도_여름() { + public Semester semester_2020년도_여름() { return semesterRepositoryV3.save( Semester.builder() .semester("2020-여름") @@ -97,7 +87,7 @@ public Semester semester(String semester) { ); } - public Semester semesterV3_2020년도_겨울() { + public Semester semester_2020년도_겨울() { return semesterRepositoryV3.save( Semester.builder() .semester("2020-겨울") @@ -106,4 +96,164 @@ public Semester semester(String semester) { .build() ); } + + public Semester semester_2021년도_1학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20211") + .year(2021) + .term(Term.FIRST) + .build() + ); + } + + public Semester semester_2021년도_2학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20212") + .year(2021) + .term(Term.SECOND) + .build() + ); + } + + public Semester semester_2021년도_여름() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2021-여름") + .year(2021) + .term(Term.SUMMER) + .build() + ); + } + + public Semester semester_2021년도_겨울() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2021-겨울") + .year(2021) + .term(Term.WINTER) + .build() + ); + } + + public Semester semester_2022년도_1학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20221") + .year(2022) + .term(Term.FIRST) + .build() + ); + } + + public Semester semester_2022년도_2학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20222") + .year(2022) + .term(Term.SECOND) + .build() + ); + } + + public Semester semester_2022년도_여름() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2022-여름") + .year(2022) + .term(Term.SUMMER) + .build() + ); + } + + public Semester semester_2022년도_겨울() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2022-겨울") + .year(2022) + .term(Term.WINTER) + .build() + ); + } + + public Semester semester_2023년도_1학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20231") + .year(2023) + .term(Term.FIRST) + .build() + ); + } + + public Semester semester_2023년도_2학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20232") + .year(2023) + .term(Term.SECOND) + .build() + ); + } + + public Semester semester_2023년도_여름() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2023-여름") + .year(2023) + .term(Term.SUMMER) + .build() + ); + } + + public Semester semester_2023년도_겨울() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2023-겨울") + .year(2023) + .term(Term.WINTER) + .build() + ); + } + + public Semester semester_2024년도_1학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20241") + .year(2024) + .term(Term.FIRST) + .build() + ); + } + + public Semester semester_2024년도_2학기() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("20242") + .year(2024) + .term(Term.SECOND) + .build() + ); + } + + public Semester semester_2024년도_여름() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2024-여름") + .year(2024) + .term(Term.SUMMER) + .build() + ); + } + + public Semester semester_2024년도_겨울() { + return semesterRepositoryV3.save( + Semester.builder() + .semester("2024-겨울") + .year(2024) + .term(Term.WINTER) + .build() + ); + } }