From ebfee05dceb6d192994b232eb02d12886b841877 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:43:42 +0900 Subject: [PATCH 01/10] =?UTF-8?q?test:=20=EC=A7=80=EC=9B=90=EC=84=9C=20?= =?UTF-8?q?=EC=A0=9C=EC=B6=9C=20=EA=B4=80=EB=A0=A8=20=ED=86=B5=ED=95=A9?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplicationSubmissionServiceTest.java | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java new file mode 100644 index 000000000..5a24b4022 --- /dev/null +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java @@ -0,0 +1,202 @@ +package com.example.solidconnection.application.service; + +import com.example.solidconnection.application.domain.Application; +import com.example.solidconnection.application.domain.Gpa; +import com.example.solidconnection.application.domain.LanguageTest; +import com.example.solidconnection.application.dto.ApplyRequest; +import com.example.solidconnection.application.dto.UniversityChoiceRequest; +import com.example.solidconnection.application.repository.ApplicationRepository; +import com.example.solidconnection.custom.exception.CustomException; +import com.example.solidconnection.score.domain.GpaScore; +import com.example.solidconnection.score.domain.LanguageTestScore; +import com.example.solidconnection.score.repository.GpaScoreRepository; +import com.example.solidconnection.score.repository.LanguageTestScoreRepository; +import com.example.solidconnection.siteuser.domain.SiteUser; +import com.example.solidconnection.support.integration.BaseIntegrationTest; +import com.example.solidconnection.type.LanguageTestType; +import com.example.solidconnection.type.VerifyStatus; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDate; + +import static com.example.solidconnection.application.service.ApplicationSubmissionService.APPLICATION_UPDATE_COUNT_LIMIT; +import static com.example.solidconnection.custom.exception.ErrorCode.APPLY_UPDATE_LIMIT_EXCEED; +import static com.example.solidconnection.custom.exception.ErrorCode.CANT_APPLY_FOR_SAME_UNIVERSITY; +import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_GPA_SCORE_STATUS; +import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_LANGUAGE_TEST_SCORE_STATUS; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode; +import static org.junit.jupiter.api.Assertions.assertAll; + +@DisplayName("지원서 제출 서비스 테스트") +class ApplicationSubmissionServiceTest extends BaseIntegrationTest { + + @Autowired + private ApplicationSubmissionService applicationSubmissionService; + + @Autowired + private ApplicationRepository applicationRepository; + + @Autowired + private GpaScoreRepository gpaScoreRepository; + + @Autowired + private LanguageTestScoreRepository languageTestScoreRepository; + + @Test + void 정상적으로_지원서를_제출한다() { + // given + GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); + LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); + UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( + 괌대학_A_지원_정보.getId(), + 네바다주립대학_라스베이거스_지원_정보.getId(), + 메모리얼대학_세인트존스_A_지원_정보.getId() + ); + ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); + + // when + boolean result = applicationSubmissionService.apply(테스트유저_1.getEmail(), request); + + // then + Application savedApplication = applicationRepository.findBySiteUserAndTerm(테스트유저_1, term).orElseThrow(); + assertAll( + () -> assertThat(result).isTrue(), + () -> assertThat(savedApplication.getGpa()).isEqualTo(gpaScore.getGpa()), + () -> assertThat(savedApplication.getLanguageTest()).isEqualTo(languageTestScore.getLanguageTest()), + () -> assertThat(savedApplication.getVerifyStatus()).isEqualTo(VerifyStatus.APPROVED), + () -> assertThat(savedApplication.getNicknameForApply()).isNotNull(), + () -> assertThat(savedApplication.getUpdateCount()).isZero(), + () -> assertThat(savedApplication.getTerm()).isEqualTo(term), + () -> assertThat(savedApplication.isDelete()).isFalse(), + () -> assertThat(savedApplication.getFirstChoiceUniversity().getId()).isEqualTo(괌대학_A_지원_정보.getId()), + () -> assertThat(savedApplication.getSecondChoiceUniversity().getId()).isEqualTo(네바다주립대학_라스베이거스_지원_정보.getId()), + () -> assertThat(savedApplication.getThirdChoiceUniversity().getId()).isEqualTo(메모리얼대학_세인트존스_A_지원_정보.getId()), + () -> assertThat(savedApplication.getSiteUser().getId()).isEqualTo(테스트유저_1.getId()) + ); + } + + @Test + void 미승인된_GPA_성적으로_지원하면_예외_응답을_반환한다() { + // given + GpaScore gpaScore = createUnApprovedGpaScore(테스트유저_1); + LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); + UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( + 괌대학_A_지원_정보.getId(), + 네바다주립대학_라스베이거스_지원_정보.getId(), + 메모리얼대학_세인트존스_A_지원_정보.getId() + ); + ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); + + // when & then + assertThatCode(() -> + applicationSubmissionService.apply(테스트유저_1.getEmail(), request) + ) + .isInstanceOf(CustomException.class) + .hasMessage(INVALID_GPA_SCORE_STATUS.getMessage()); + } + + @Test + void 미승인된_어학성적으로_지원하면_예외_응답을_반환한다() { + // given + GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); + LanguageTestScore languageTestScore = createUnApprovedLanguageTestScore(테스트유저_1); + UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( + 괌대학_A_지원_정보.getId(), + 네바다주립대학_라스베이거스_지원_정보.getId(), + 메모리얼대학_세인트존스_A_지원_정보.getId() + ); + ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); + + // when & then + assertThatCode(() -> + applicationSubmissionService.apply(테스트유저_1.getEmail(), request) + ) + .isInstanceOf(CustomException.class) + .hasMessage(INVALID_LANGUAGE_TEST_SCORE_STATUS.getMessage()); + } + + @Test + void 동일한_대학을_중복_선택하면_예외_응답을_반환한다() { + // given + GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); + LanguageTestScore languageTestScore = createUnApprovedLanguageTestScore(테스트유저_1); + UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( + 괌대학_A_지원_정보.getId(), + 괌대학_A_지원_정보.getId(), + 메모리얼대학_세인트존스_A_지원_정보.getId() + ); + ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); + + // when & then + assertThatCode(() -> + applicationSubmissionService.apply(테스트유저_1.getEmail(), request) + ) + .isInstanceOf(CustomException.class) + .hasMessage(CANT_APPLY_FOR_SAME_UNIVERSITY.getMessage()); + } + + @Test + void 지원서_수정_횟수를_초과하면_예외_응답을_반환한다() { + // given + GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); + LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); + UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( + 괌대학_A_지원_정보.getId(), + 네바다주립대학_라스베이거스_지원_정보.getId(), + 메모리얼대학_세인트존스_A_지원_정보.getId() + ); + ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); + + for (int i = 0; i < APPLICATION_UPDATE_COUNT_LIMIT + 1; i++) { + applicationSubmissionService.apply(테스트유저_1.getEmail(), request); + } + + // when & then + assertThatCode(() -> + applicationSubmissionService.apply(테스트유저_1.getEmail(), request) + ) + .isInstanceOf(CustomException.class) + .hasMessage(APPLY_UPDATE_LIMIT_EXCEED.getMessage()); + } + + private GpaScore createUnApprovedGpaScore(SiteUser siteUser) { + GpaScore gpaScore = new GpaScore( + new Gpa(4.0, 4.5, "/gpa-report.pdf"), + siteUser, + LocalDate.now() + ); + return gpaScoreRepository.save(gpaScore); + } + + private GpaScore createApprovedGpaScore(SiteUser siteUser) { + GpaScore gpaScore = new GpaScore( + new Gpa(4.0, 4.5, "/gpa-report.pdf"), + siteUser, + LocalDate.now() + ); + gpaScore.setVerifyStatus(VerifyStatus.APPROVED); + return gpaScoreRepository.save(gpaScore); + } + + private LanguageTestScore createUnApprovedLanguageTestScore(SiteUser siteUser) { + LanguageTestScore languageTestScore = new LanguageTestScore( + new LanguageTest(LanguageTestType.TOEIC, "100", "/gpa-report.pdf"), + LocalDate.now(), + siteUser + ); + return languageTestScoreRepository.save(languageTestScore); + } + + private LanguageTestScore createApprovedLanguageTestScore(SiteUser siteUser) { + LanguageTestScore languageTestScore = new LanguageTestScore( + new LanguageTest(LanguageTestType.TOEIC, "100", "/gpa-report.pdf"), + LocalDate.now(), + siteUser + ); + languageTestScore.setVerifyStatus(VerifyStatus.APPROVED); + return languageTestScoreRepository.save(languageTestScore); + } +} From 194cd92cf9a0d852b7c83b72fc3005a5055e0ef6 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:06:31 +0900 Subject: [PATCH 02/10] =?UTF-8?q?test:=20=EC=A7=80=EC=9B=90=EC=9E=90=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=86=B5=ED=95=A9=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 156 ++++++++++++++++++ .../integration/BaseIntegrationTest.java | 144 ++++++++++++++++ 2 files changed, 300 insertions(+) create mode 100644 src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java new file mode 100644 index 000000000..283afb3e3 --- /dev/null +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -0,0 +1,156 @@ +package com.example.solidconnection.application.service; + +import com.example.solidconnection.application.dto.ApplicantResponse; +import com.example.solidconnection.application.dto.ApplicationsResponse; +import com.example.solidconnection.application.dto.UniversityApplicantsResponse; +import com.example.solidconnection.support.integration.BaseIntegrationTest; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +@DisplayName("지원서 조회 서비스 테스트") +class ApplicationQueryServiceTest extends BaseIntegrationTest { + + @Autowired + private ApplicationQueryService applicationQueryService; + + @Nested + class 지원자_목록_조회_테스트 { + + @Test + void 이번학기_전체_지원자를_조회한다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicants( + 테스트유저_1.getEmail(), + "", + "" + ); + + // then + assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), + UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))), + UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, false))) + )); + + assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), + UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))), + UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, false))) + )); + + assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), + UniversityApplicantsResponse.of(그라츠대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), + UniversityApplicantsResponse.of(그라츠공과대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) + )); + + assertThat(response.thirdChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(린츠_카톨릭대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(그라츠공과대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), + UniversityApplicantsResponse.of(서던덴마크대학교_지원_정보, + List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) + )); + } + + @Test + void 이번학기_특정_지역_지원자를_조회한다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicants( + 테스트유저_1.getEmail(), + 영미권.getCode(), + "" + ); + + // then + assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) + )); + + assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) + )); + } + + @Test + void 이번학기_지원자를_대학_국문_이름으로_필터링해서_조회한다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicants( + 테스트유저_1.getEmail(), + null, + "일본" + ); + + // then + assertThat(response.firstChoice()).containsExactlyInAnyOrder( + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))) + ); + + assertThat(response.thirdChoice()).containsExactlyInAnyOrder( + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) + ); + } + + @Test + void 이전학기_지원자는_조회되지_않는다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicants( + 테스트유저_1.getEmail(), + "", + "" + ); + + // then + assertThat(response.firstChoice()).doesNotContainAnyElementsOf(List.of( + UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, + List.of(ApplicantResponse.of(이전학기_지원서, false))) + )); + assertThat(response.secondChoice()).doesNotContainAnyElementsOf(List.of( + UniversityApplicantsResponse.of(그라츠공과대학_지원_정보, + List.of(ApplicantResponse.of(이전학기_지원서, false))) + )); + assertThat(response.thirdChoice()).doesNotContainAnyElementsOf(List.of( + UniversityApplicantsResponse.of(메이지대학_지원_정보, + List.of(ApplicantResponse.of(이전학기_지원서, false))) + )); + } + } +} diff --git a/src/test/java/com/example/solidconnection/support/integration/BaseIntegrationTest.java b/src/test/java/com/example/solidconnection/support/integration/BaseIntegrationTest.java index f588b87ae..27088fab1 100644 --- a/src/test/java/com/example/solidconnection/support/integration/BaseIntegrationTest.java +++ b/src/test/java/com/example/solidconnection/support/integration/BaseIntegrationTest.java @@ -1,11 +1,19 @@ package com.example.solidconnection.support.integration; +import com.example.solidconnection.application.domain.Application; +import com.example.solidconnection.application.domain.Gpa; +import com.example.solidconnection.application.domain.LanguageTest; +import com.example.solidconnection.application.repository.ApplicationRepository; import com.example.solidconnection.board.domain.Board; import com.example.solidconnection.board.repository.BoardRepository; import com.example.solidconnection.entity.Country; import com.example.solidconnection.entity.Region; import com.example.solidconnection.repositories.CountryRepository; import com.example.solidconnection.repositories.RegionRepository; +import com.example.solidconnection.score.domain.GpaScore; +import com.example.solidconnection.score.domain.LanguageTestScore; +import com.example.solidconnection.score.repository.GpaScoreRepository; +import com.example.solidconnection.score.repository.LanguageTestScoreRepository; import com.example.solidconnection.siteuser.domain.SiteUser; import com.example.solidconnection.siteuser.repository.SiteUserRepository; import com.example.solidconnection.support.DatabaseClearExtension; @@ -14,6 +22,7 @@ import com.example.solidconnection.type.LanguageTestType; import com.example.solidconnection.type.PreparationStatus; import com.example.solidconnection.type.Role; +import com.example.solidconnection.type.VerifyStatus; import com.example.solidconnection.university.domain.LanguageRequirement; import com.example.solidconnection.university.domain.University; import com.example.solidconnection.university.domain.UniversityInfoForApply; @@ -25,7 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import java.time.LocalDate; import java.util.HashSet; +import java.util.List; import static com.example.solidconnection.type.BoardCode.AMERICAS; import static com.example.solidconnection.type.BoardCode.ASIA; @@ -40,6 +51,12 @@ public abstract class BaseIntegrationTest { public static SiteUser 테스트유저_1; public static SiteUser 테스트유저_2; + public static SiteUser 테스트유저_3; + public static SiteUser 테스트유저_4; + public static SiteUser 테스트유저_5; + public static SiteUser 테스트유저_6; + public static SiteUser 테스트유저_7; + public static SiteUser 이전학기_지원자; public static Region 영미권; public static Region 유럽; @@ -71,6 +88,14 @@ public abstract class BaseIntegrationTest { public static UniversityInfoForApply 린츠_카톨릭대학_지원_정보; public static UniversityInfoForApply 메이지대학_지원_정보; + public static Application 테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서; + public static Application 테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서; + public static Application 테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서; + public static Application 테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서; + public static Application 테스트유저_6_X_X_X_지원서; + public static Application 테스트유저_7_코펜하겐IT대학_X_X_지원서; + public static Application 이전학기_지원서; + public static Board 미주권; public static Board 아시아권; public static Board 유럽권; @@ -94,6 +119,15 @@ public abstract class BaseIntegrationTest { @Autowired private LanguageRequirementRepository languageRequirementRepository; + @Autowired + private ApplicationRepository applicationRepository; + + @Autowired + private GpaScoreRepository gpaScoreRepository; + + @Autowired + private LanguageTestScoreRepository languageTestScoreRepository; + @Autowired private BoardRepository boardRepository; @@ -108,6 +142,7 @@ public void setUpBaseData() { setUpUniversities(); setUpUniversityInfos(); setUpLanguageRequirements(); + setUpApplications(); setUpBoards(); } @@ -129,6 +164,60 @@ private void setUpSiteUsers() { PreparationStatus.CONSIDERING, Role.MENTEE, Gender.FEMALE)); + + 테스트유저_3 = siteUserRepository.save(new SiteUser( + "test3@example.com", + "nickname3", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.MALE)); + + 테스트유저_4 = siteUserRepository.save(new SiteUser( + "test4@example.com", + "nickname4", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.FEMALE)); + + 테스트유저_5 = siteUserRepository.save(new SiteUser( + "test5@example.com", + "nickname5", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.MALE)); + + 테스트유저_6 = siteUserRepository.save(new SiteUser( + "test6@example.com", + "nickname6", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.FEMALE)); + + 테스트유저_7 = siteUserRepository.save(new SiteUser( + "test7@example.com", + "nickname7", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.FEMALE)); + + 이전학기_지원자 = siteUserRepository.save(new SiteUser( + "old@example.com", + "oldNickname", + "profileImageUrl", + "1999-01-01", + PreparationStatus.CONSIDERING, + Role.MENTEE, + Gender.MALE)); } private void setUpRegions() { @@ -330,6 +419,41 @@ private void setUpLanguageRequirements() { saveLanguageTestRequirement(메이지대학_지원_정보, LanguageTestType.JLPT, "N2"); } + private void setUpApplications() { + 테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서 = new Application(테스트유저_2, createApprovedGpaScore(테스트유저_2).getGpa(), createApprovedLanguageTestScore(테스트유저_2).getLanguageTest(), + term, 괌대학_B_지원_정보, 괌대학_A_지원_정보, 린츠_카톨릭대학_지원_정보, "user2_nickname"); + + 테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서 = new Application(테스트유저_3, createApprovedGpaScore(테스트유저_3).getGpa(), createApprovedLanguageTestScore(테스트유저_3).getLanguageTest(), + term, 괌대학_A_지원_정보, 괌대학_B_지원_정보, 그라츠공과대학_지원_정보, "user3_nickname"); + + 테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서 = new Application(테스트유저_4, createApprovedGpaScore(테스트유저_4).getGpa(), createApprovedLanguageTestScore(테스트유저_4).getLanguageTest(), + term, 메이지대학_지원_정보, 그라츠대학_지원_정보, 서던덴마크대학교_지원_정보, "user4_nickname"); + + 테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서 = new Application(테스트유저_5, createApprovedGpaScore(테스트유저_5).getGpa(), createApprovedLanguageTestScore(테스트유저_5).getLanguageTest(), + term, 네바다주립대학_라스베이거스_지원_정보, 그라츠공과대학_지원_정보, 메이지대학_지원_정보, "user5_nickname"); + + 테스트유저_6_X_X_X_지원서 = new Application(테스트유저_6, createApprovedGpaScore(테스트유저_6).getGpa(), createApprovedLanguageTestScore(테스트유저_6).getLanguageTest(), + term, null, null, null, "user6_nickname"); + + 테스트유저_7_코펜하겐IT대학_X_X_지원서 = new Application(테스트유저_7, createApprovedGpaScore(테스트유저_7).getGpa(), createApprovedLanguageTestScore(테스트유저_7).getLanguageTest(), + term, 코펜하겐IT대학_지원_정보, null, null, "user7_nickname"); + + 이전학기_지원서 = new Application(이전학기_지원자, createApprovedGpaScore(이전학기_지원자).getGpa(), createApprovedLanguageTestScore(이전학기_지원자).getLanguageTest(), + "1988-1", 네바다주립대학_라스베이거스_지원_정보, 그라츠공과대학_지원_정보, 메이지대학_지원_정보, "old_nickname"); + + 테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 테스트유저_6_X_X_X_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 테스트유저_7_코펜하겐IT대학_X_X_지원서.setVerifyStatus(VerifyStatus.APPROVED); + 이전학기_지원서.setVerifyStatus(VerifyStatus.APPROVED); + + applicationRepository.saveAll(List.of( + 테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, 테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, 테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, 테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, + 테스트유저_6_X_X_X_지원서, 테스트유저_7_코펜하겐IT대학_X_X_지원서, 이전학기_지원서)); + } + private void setUpBoards() { 미주권 = boardRepository.save(new Board(AMERICAS.name(), "미주권")); 아시아권 = boardRepository.save(new Board(ASIA.name(), "아시아권")); @@ -351,4 +475,24 @@ private void saveLanguageTestRequirement( universityInfoForApplyRepository.save(universityInfoForApply); languageRequirementRepository.save(languageRequirement); } + + private GpaScore createApprovedGpaScore(SiteUser siteUser) { + GpaScore gpaScore = new GpaScore( + new Gpa(4.0, 4.5, "/gpa-report.pdf"), + siteUser, + LocalDate.now() + ); + gpaScore.setVerifyStatus(VerifyStatus.APPROVED); + return gpaScoreRepository.save(gpaScore); + } + + private LanguageTestScore createApprovedLanguageTestScore(SiteUser siteUser) { + LanguageTestScore languageTestScore = new LanguageTestScore( + new LanguageTest(LanguageTestType.TOEIC, "100", "/gpa-report.pdf"), + LocalDate.now(), + siteUser + ); + languageTestScore.setVerifyStatus(VerifyStatus.APPROVED); + return languageTestScoreRepository.save(languageTestScore); + } } From d9267b743f096fa0947c12e814e6b7c6eaf3f5c1 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:21:06 +0900 Subject: [PATCH 03/10] =?UTF-8?q?test:=20=EA=B2=BD=EC=9F=81=EC=9E=90=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=86=B5=ED=95=A9=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index 283afb3e3..9f4f8b347 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -153,4 +153,72 @@ class 지원자_목록_조회_테스트 { )); } } + + @Nested + class 경쟁자_목록_조회_테스트 { + + @Test + void 이번학기_지원한_대학의_경쟁자_목록을_조회한다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( + 테스트유저_2.getEmail() + ); + + // then + assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) + )); + + assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(괌대학_A_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + UniversityApplicantsResponse.of(괌대학_B_지원_정보, + List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) + )); + + assertThat(response.thirdChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(린츠_카톨릭대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))) + )); + } + + @Test + void 이번학기_지원한_대학중_미선택이_있을_때_경쟁자_목록을_조회한다() { + // when + ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( + 테스트유저_7.getEmail() + ); + + // then + assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, + List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, true))) + )); + + assertThat(response.secondChoice()).containsExactlyInAnyOrder( + UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, List.of()) + ); + + assertThat(response.thirdChoice()).containsExactlyInAnyOrder( + UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, List.of()) + ); + } + + + @Test + void 이번학기_지원한_대학이_모두_미선택일_때_경쟁자_목록을_조회한다() { + //when + ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( + 테스트유저_6.getEmail() + ); + + // then + assertThat(response.firstChoice()).isEmpty(); + assertThat(response.secondChoice()).isEmpty(); + assertThat(response.thirdChoice()).isEmpty(); + } + } } From deba02f4ad004c4666f8a6f5c5e9f4ad4c087d2f Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:23:38 +0900 Subject: [PATCH 04/10] =?UTF-8?q?test:=20=EC=9D=B4=EB=B2=88=ED=95=99?= =?UTF-8?q?=EA=B8=B0=20=EC=A7=80=EC=9B=90=EC=9E=90=20=EB=8C=80=ED=95=99?= =?UTF-8?q?=EA=B5=AD=EB=AC=B8=20=ED=95=84=ED=84=B0=EB=A7=81=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=8B=9C=20secondChoice=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/ApplicationQueryServiceTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index 9f4f8b347..b5e23b525 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -123,6 +123,10 @@ class 지원자_목록_조회_테스트 { List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))) ); + assertThat(response.secondChoice()).containsExactlyInAnyOrder( + UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of()) + ); + assertThat(response.thirdChoice()).containsExactlyInAnyOrder( UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) From 6978386c1ee70e73df3807c24ad63e0c063fcf89 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:25:29 +0900 Subject: [PATCH 05/10] =?UTF-8?q?style:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EA=B0=9C=ED=96=89=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/ApplicationQueryServiceTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index b5e23b525..219851510 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -211,7 +211,6 @@ class 경쟁자_목록_조회_테스트 { ); } - @Test void 이번학기_지원한_대학이_모두_미선택일_때_경쟁자_목록을_조회한다() { //when From c18d3b295edc627ca4fed38d4f70fae908e741fc Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:48:49 +0900 Subject: [PATCH 06/10] =?UTF-8?q?refactor:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=9D=B4=EB=A6=84=EC=97=90=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 14 +++++++------- .../service/ApplicationSubmissionServiceTest.java | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index 219851510..0fcdc985f 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -23,7 +23,7 @@ class ApplicationQueryServiceTest extends BaseIntegrationTest { class 지원자_목록_조회_테스트 { @Test - void 이번학기_전체_지원자를_조회한다() { + void 이번_학기_전체_지원자를_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( 테스트유저_1.getEmail(), @@ -82,7 +82,7 @@ class 지원자_목록_조회_테스트 { } @Test - void 이번학기_특정_지역_지원자를_조회한다() { + void 이번_학기_특정_지역_지원자를_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( 테스트유저_1.getEmail(), @@ -109,7 +109,7 @@ class 지원자_목록_조회_테스트 { } @Test - void 이번학기_지원자를_대학_국문_이름으로_필터링해서_조회한다() { + void 이번_학기_지원자를_대학_국문_이름으로_필터링해서_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( 테스트유저_1.getEmail(), @@ -134,7 +134,7 @@ class 지원자_목록_조회_테스트 { } @Test - void 이전학기_지원자는_조회되지_않는다() { + void 이전_학기_지원자는_조회되지_않는다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( 테스트유저_1.getEmail(), @@ -162,7 +162,7 @@ class 지원자_목록_조회_테스트 { class 경쟁자_목록_조회_테스트 { @Test - void 이번학기_지원한_대학의_경쟁자_목록을_조회한다() { + void 이번_학기_지원한_대학의_경쟁자_목록을_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( 테스트유저_2.getEmail() @@ -190,7 +190,7 @@ class 경쟁자_목록_조회_테스트 { } @Test - void 이번학기_지원한_대학중_미선택이_있을_때_경쟁자_목록을_조회한다() { + void 이번_학기_지원한_대학_중_미선택이_있을_때_경쟁자_목록을_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( 테스트유저_7.getEmail() @@ -212,7 +212,7 @@ class 경쟁자_목록_조회_테스트 { } @Test - void 이번학기_지원한_대학이_모두_미선택일_때_경쟁자_목록을_조회한다() { + void 이번_학기_지원한_대학이_모두_미선택일_때_경쟁자_목록을_조회한다() { //when ApplicationsResponse response = applicationQueryService.getApplicantsByUserApplications( 테스트유저_6.getEmail() diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java index 5a24b4022..9b9f93c63 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java @@ -81,7 +81,7 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { @Test void 미승인된_GPA_성적으로_지원하면_예외_응답을_반환한다() { // given - GpaScore gpaScore = createUnApprovedGpaScore(테스트유저_1); + GpaScore gpaScore = createUnapprovedGpaScore(테스트유저_1); LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), @@ -102,7 +102,7 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { void 미승인된_어학성적으로_지원하면_예외_응답을_반환한다() { // given GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); - LanguageTestScore languageTestScore = createUnApprovedLanguageTestScore(테스트유저_1); + LanguageTestScore languageTestScore = createUnapprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), 네바다주립대학_라스베이거스_지원_정보.getId(), @@ -122,7 +122,7 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { void 동일한_대학을_중복_선택하면_예외_응답을_반환한다() { // given GpaScore gpaScore = createApprovedGpaScore(테스트유저_1); - LanguageTestScore languageTestScore = createUnApprovedLanguageTestScore(테스트유저_1); + LanguageTestScore languageTestScore = createUnapprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), 괌대학_A_지원_정보.getId(), @@ -162,7 +162,7 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { .hasMessage(APPLY_UPDATE_LIMIT_EXCEED.getMessage()); } - private GpaScore createUnApprovedGpaScore(SiteUser siteUser) { + private GpaScore createUnapprovedGpaScore(SiteUser siteUser) { GpaScore gpaScore = new GpaScore( new Gpa(4.0, 4.5, "/gpa-report.pdf"), siteUser, @@ -181,7 +181,7 @@ private GpaScore createApprovedGpaScore(SiteUser siteUser) { return gpaScoreRepository.save(gpaScore); } - private LanguageTestScore createUnApprovedLanguageTestScore(SiteUser siteUser) { + private LanguageTestScore createUnapprovedLanguageTestScore(SiteUser siteUser) { LanguageTestScore languageTestScore = new LanguageTestScore( new LanguageTest(LanguageTestType.TOEIC, "100", "/gpa-report.pdf"), LocalDate.now(), From 8f4d2c8470be48ed3ead4009c96c7019d6924b9f Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:54:41 +0900 Subject: [PATCH 07/10] =?UTF-8?q?test:=20UniversityChoiceRequest=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=9D=B8=EC=9E=90=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationSubmissionServiceTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java index 9b9f93c63..84f130d54 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java @@ -85,8 +85,8 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), - 네바다주립대학_라스베이거스_지원_정보.getId(), - 메모리얼대학_세인트존스_A_지원_정보.getId() + null, + null ); ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); @@ -105,8 +105,8 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { LanguageTestScore languageTestScore = createUnapprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), - 네바다주립대학_라스베이거스_지원_정보.getId(), - 메모리얼대학_세인트존스_A_지원_정보.getId() + null, + null ); ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); @@ -145,8 +145,8 @@ class ApplicationSubmissionServiceTest extends BaseIntegrationTest { LanguageTestScore languageTestScore = createApprovedLanguageTestScore(테스트유저_1); UniversityChoiceRequest universityChoiceRequest = new UniversityChoiceRequest( 괌대학_A_지원_정보.getId(), - 네바다주립대학_라스베이거스_지원_정보.getId(), - 메모리얼대학_세인트존스_A_지원_정보.getId() + null, + null ); ApplyRequest request = new ApplyRequest(gpaScore.getId(), languageTestScore.getId(), universityChoiceRequest); From 856db5f63238cb4c679d93b7e20f96f956bf67c0 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:58:11 +0900 Subject: [PATCH 08/10] =?UTF-8?q?test:=20firstChoice=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EA=B2=80=EC=A6=9D=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index 0fcdc985f..06daf4752 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -45,19 +45,6 @@ class 지원자_목록_조회_테스트 { List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, false))) )); - assertThat(response.firstChoice()).containsAnyElementsOf(List.of( - UniversityApplicantsResponse.of(괌대학_A_지원_정보, - List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), - UniversityApplicantsResponse.of(괌대학_B_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), - UniversityApplicantsResponse.of(메이지대학_지원_정보, - List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), - UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, - List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))), - UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, - List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, false))) - )); - assertThat(response.secondChoice()).containsAnyElementsOf(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), From f2e42e0f6a5129844e6129fce6327113312e2035 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:26:17 +0900 Subject: [PATCH 09/10] =?UTF-8?q?test:=20cntainsAll=EB=A1=9C=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=ED=95=98=EB=8A=94=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index 06daf4752..b29fa15b3 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -32,11 +32,11 @@ class 지원자_목록_조회_테스트 { ); // then - assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + assertThat(response.firstChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, @@ -45,9 +45,9 @@ class 지원자_목록_조회_테스트 { List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, false))) )); - assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(그라츠대학_지원_정보, @@ -56,9 +56,9 @@ class 지원자_목록_조회_테스트 { List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) )); - assertThat(response.thirdChoice()).containsAnyElementsOf(List.of( + assertThat(response.thirdChoice()).containsAll(List.of( UniversityApplicantsResponse.of(린츠_카톨릭대학_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), UniversityApplicantsResponse.of(그라츠공과대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(서던덴마크대학교_지원_정보, @@ -78,18 +78,18 @@ class 지원자_목록_조회_테스트 { ); // then - assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + assertThat(response.firstChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) )); - assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) )); @@ -105,14 +105,14 @@ class 지원자_목록_조회_테스트 { ); // then - assertThat(response.firstChoice()).containsExactlyInAnyOrder( + assertThat(response.firstChoice()).containsAll(List.of( UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))) - ); + )); - assertThat(response.secondChoice()).containsExactlyInAnyOrder( + assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of()) - ); + )); assertThat(response.thirdChoice()).containsExactlyInAnyOrder( UniversityApplicantsResponse.of(메이지대학_지원_정보, @@ -156,21 +156,21 @@ class 경쟁자_목록_조회_테스트 { ); // then - assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + assertThat(response.firstChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) )); - assertThat(response.secondChoice()).containsAnyElementsOf(List.of( + assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) )); - assertThat(response.thirdChoice()).containsAnyElementsOf(List.of( + assertThat(response.thirdChoice()).containsAll(List.of( UniversityApplicantsResponse.of(린츠_카톨릭대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))) )); @@ -184,7 +184,7 @@ class 경쟁자_목록_조회_테스트 { ); // then - assertThat(response.firstChoice()).containsAnyElementsOf(List.of( + assertThat(response.firstChoice()).containsAll(List.of( UniversityApplicantsResponse.of(코펜하겐IT대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_7_코펜하겐IT대학_X_X_지원서, true))) )); From 0dc7607b1f265e9852a3f41ddce8cd4be6049fa0 Mon Sep 17 00:00:00 2001 From: Gyuhyeok99 <126947828+Gyuhyeok99@users.noreply.github.com> Date: Tue, 4 Feb 2025 09:07:01 +0900 Subject: [PATCH 10/10] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EC=9C=A0=EC=A0=802=EB=A1=9C=20=EA=B2=80=EC=A6=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplicationQueryServiceTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java index b29fa15b3..b8f5cd283 100644 --- a/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java +++ b/src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java @@ -26,7 +26,7 @@ class 지원자_목록_조회_테스트 { void 이번_학기_전체_지원자를_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( - 테스트유저_1.getEmail(), + 테스트유저_2.getEmail(), "", "" ); @@ -36,7 +36,7 @@ class 지원자_목록_조회_테스트 { UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(메이지대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_4_메이지대학_그라츠대학_서던덴마크대학_지원서, false))), UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, @@ -47,7 +47,7 @@ class 지원자_목록_조회_테스트 { assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(그라츠대학_지원_정보, @@ -58,7 +58,7 @@ class 지원자_목록_조회_테스트 { assertThat(response.thirdChoice()).containsAll(List.of( UniversityApplicantsResponse.of(린츠_카톨릭대학_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(그라츠공과대학_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(서던덴마크대학교_지원_정보, @@ -72,7 +72,7 @@ class 지원자_목록_조회_테스트 { void 이번_학기_특정_지역_지원자를_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( - 테스트유저_1.getEmail(), + 테스트유저_2.getEmail(), 영미권.getCode(), "" ); @@ -82,14 +82,14 @@ class 지원자_목록_조회_테스트 { UniversityApplicantsResponse.of(괌대학_A_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(네바다주립대학_라스베이거스_지원_정보, List.of(ApplicantResponse.of(테스트유저_5_네바다주립대학_그라츠공과대학_메이지대학_지원서, false))) )); assertThat(response.secondChoice()).containsAll(List.of( UniversityApplicantsResponse.of(괌대학_A_지원_정보, - List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, false))), + List.of(ApplicantResponse.of(테스트유저_2_괌대학_B_괌대학_A_린츠_카톨릭대학_지원서, true))), UniversityApplicantsResponse.of(괌대학_B_지원_정보, List.of(ApplicantResponse.of(테스트유저_3_괌대학_A_괌대학_B_그라츠공과대학_지원서, false))) )); @@ -99,7 +99,7 @@ class 지원자_목록_조회_테스트 { void 이번_학기_지원자를_대학_국문_이름으로_필터링해서_조회한다() { // when ApplicationsResponse response = applicationQueryService.getApplicants( - 테스트유저_1.getEmail(), + 테스트유저_2.getEmail(), null, "일본" );