From 58623dfd66fc2d0f1d4af6418ae08e574c79dd4f Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Sun, 7 Dec 2025 16:16:04 +0900 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=EB=A9=98=ED=86=A0=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=EC=84=9C=20=EA=B2=80=EC=83=89=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EC=97=90=20UniversitySelectType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/dto/MentorApplicationSearchCondition.java | 4 +++- .../custom/MentorApplicationFilterRepositoryImpl.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java index 9871ba6d..0f987d91 100644 --- a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java +++ b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java @@ -1,12 +1,14 @@ package com.example.solidconnection.admin.dto; import com.example.solidconnection.mentor.domain.MentorApplicationStatus; +import com.example.solidconnection.mentor.domain.UniversitySelectType; import java.time.LocalDate; public record MentorApplicationSearchCondition( MentorApplicationStatus mentorApplicationStatus, String keyword, - LocalDate createdAt + LocalDate createdAt, + UniversitySelectType universitySelectType ) { } \ No newline at end of file diff --git a/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java b/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java index 788bda8a..4c048754 100644 --- a/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java +++ b/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java @@ -12,6 +12,7 @@ import com.example.solidconnection.admin.dto.MentorApplicationSearchResponse; import com.example.solidconnection.admin.dto.SiteUserResponse; import com.example.solidconnection.mentor.domain.MentorApplicationStatus; +import com.example.solidconnection.mentor.domain.UniversitySelectType; import com.querydsl.core.types.ConstructorExpression; import com.querydsl.core.types.Projections; import com.querydsl.core.types.dsl.BooleanExpression; @@ -81,7 +82,8 @@ public Page searchMentorApplications(MentorAppl .where( verifyMentorStatusEq(condition.mentorApplicationStatus()), keywordContains(condition.keyword()), - createdAtEq(condition.createdAt()) + createdAtEq(condition.createdAt()), + universitySelectTypeEq(condition.universitySelectType()) ) .orderBy(mentorApplication.createdAt.desc()) .offset(pageable.getOffset()) @@ -110,7 +112,8 @@ private JPAQuery createCountQuery(MentorApplicationSearchCondition conditi return query.where( verifyMentorStatusEq(condition.mentorApplicationStatus()), keywordContains(condition.keyword()), - createdAtEq(condition.createdAt()) + createdAtEq(condition.createdAt()), + universitySelectTypeEq(condition.universitySelectType()) ); } @@ -142,4 +145,8 @@ private BooleanExpression createdAtEq(LocalDate createdAt) { endOfDay.atZone(SYSTEM_ZONE_ID) ); } + + private BooleanExpression universitySelectTypeEq(UniversitySelectType universitySelectType) { + return universitySelectType != null ? mentorApplication.universitySelectType.eq(universitySelectType) : null; + } } From 05d474b167f92b114ac0abcdb3dc029f8fc9c60c Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Sun, 7 Dec 2025 16:32:41 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EB=A9=98=ED=86=A0=20=EC=A7=80=EC=9B=90=EC=84=9C=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=95=20=EC=A1=B0=ED=9A=8C=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=EC=97=90=20UniversitySelectType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../solidconnection/admin/dto/MentorApplicationResponse.java | 2 ++ .../custom/MentorApplicationFilterRepositoryImpl.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationResponse.java b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationResponse.java index 1fafc2df..5b6d6cc1 100644 --- a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationResponse.java +++ b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationResponse.java @@ -1,6 +1,7 @@ package com.example.solidconnection.admin.dto; import com.example.solidconnection.mentor.domain.MentorApplicationStatus; +import com.example.solidconnection.mentor.domain.UniversitySelectType; import java.time.ZonedDateTime; public record MentorApplicationResponse( @@ -8,6 +9,7 @@ public record MentorApplicationResponse( String region, String country, String university, + UniversitySelectType universitySelectType, String mentorProofUrl, MentorApplicationStatus mentorApplicationStatus, String rejectedReason, diff --git a/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java b/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java index 4c048754..38dc0b6e 100644 --- a/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java +++ b/src/main/java/com/example/solidconnection/mentor/repository/custom/MentorApplicationFilterRepositoryImpl.java @@ -49,6 +49,7 @@ public class MentorApplicationFilterRepositoryImpl implements MentorApplicationF region.koreanName, country.koreanName, university.koreanName, + mentorApplication.universitySelectType, mentorApplication.mentorProofUrl, mentorApplication.mentorApplicationStatus, mentorApplication.rejectedReason, From bb75aa822aaa502c3f9edcab8fe831a463201b39 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Sun, 7 Dec 2025 19:58:19 +0900 Subject: [PATCH 3/9] =?UTF-8?q?test:=20=EB=A9=98=ED=86=A0=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=EC=84=9C=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test: UniversitySelectType 기반 페이징 조회 테스트 추가 --- .../AdminMentorApplicationServiceTest.java | 71 ++++++++++++++++--- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java index dd844d86..b321299b 100644 --- a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java +++ b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java @@ -58,6 +58,8 @@ class AdminMentorApplicationServiceTest { private MentorApplication mentorApplication4; private MentorApplication mentorApplication5; private MentorApplication mentorApplication6; + private MentorApplication mentorApplication7; + private MentorApplication mentorApplication8; @BeforeEach void setUp() { @@ -67,6 +69,8 @@ void setUp() { SiteUser user4 = siteUserFixture.사용자(4, "test4"); SiteUser user5 = siteUserFixture.사용자(5, "test5"); SiteUser user6 = siteUserFixture.사용자(6, "test6"); + SiteUser user7 = siteUserFixture.사용자(7, "test7"); + SiteUser user8 = siteUserFixture.사용자(8, "test8"); University university1 = universityFixture.메이지_대학(); University university2 = universityFixture.괌_대학(); University university3 = universityFixture.그라츠_대학(); @@ -76,6 +80,8 @@ void setUp() { mentorApplication4 = mentorApplicationFixture.승인된_멘토신청(user4.getId(), UniversitySelectType.CATALOG, university3.getId()); mentorApplication5 = mentorApplicationFixture.대기중_멘토신청(user5.getId(), UniversitySelectType.CATALOG, university1.getId()); mentorApplication6 = mentorApplicationFixture.거절된_멘토신청(user6.getId(), UniversitySelectType.CATALOG, university2.getId()); + mentorApplication7 = mentorApplicationFixture.대기중_멘토신청(user7.getId(), UniversitySelectType.OTHER, null); + mentorApplication8 = mentorApplicationFixture.거절된_멘토신청(user8.getId(), UniversitySelectType.OTHER, null); } @Nested @@ -84,9 +90,9 @@ class 멘토_승격_지원서_목록_조회 { @Test void 멘토_승격_상태를_조건으로_페이징하여_조회한다() { // given - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(MentorApplicationStatus.PENDING,null, null); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(MentorApplicationStatus.PENDING,null, null, null); Pageable pageable = PageRequest.of(0, 10); - List expectedMentorApplications = List.of(mentorApplication2, mentorApplication5); + List expectedMentorApplications = List.of(mentorApplication2, mentorApplication5, mentorApplication7); // when Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); @@ -107,7 +113,7 @@ class 멘토_승격_지원서_목록_조회 { void 닉네임_keyword_에_맞는_멘토_지원서를_페이징하여_조회한다(){ // given String nickname = "test1"; - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, nickname, null); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, nickname, null, null); Pageable pageable = PageRequest.of(0, 10); List expectedMentorApplications = List.of(mentorApplication1); @@ -130,7 +136,7 @@ class 멘토_승격_지원서_목록_조회 { void 대학명_keyword_에_맞는_멘토_지원서를_페이징하여_조회한다(){ // given String universityKoreanName = "메이지 대학"; - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, universityKoreanName, null); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, universityKoreanName, null, null); Pageable pageable = PageRequest.of(0, 10); List expectedMentorApplications = List.of(mentorApplication1, mentorApplication5); @@ -153,7 +159,7 @@ class 멘토_승격_지원서_목록_조회 { void 지역명_keyword_에_맞는_멘토_지원서를_페이징하여_조회한다(){ // given String regionKoreanName = "유럽"; - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, regionKoreanName, null); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, regionKoreanName, null, null); Pageable pageable = PageRequest.of(0, 10); List expectedMentorApplications = List.of(mentorApplication3, mentorApplication4); @@ -176,7 +182,7 @@ class 멘토_승격_지원서_목록_조회 { void 나라명_keyword_에_맞는_멘토_지원서를_페이징하여_조회한다(){ // given String countryKoreanName = "오스트리아"; - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, countryKoreanName, null); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, countryKoreanName, null,null); Pageable pageable = PageRequest.of(0, 10); List expectedMentorApplications = List.of(mentorApplication3, mentorApplication4); @@ -195,11 +201,58 @@ class 멘토_승격_지원서_목록_조회 { .containsOnly(countryKoreanName); } + @Test + void CATALOG_타입의_멘토_지원서만_조회한다() { + // given + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, null, null, UniversitySelectType.CATALOG); + Pageable pageable = PageRequest.of(0, 10); + List expectedMentorApplications = List.of( + mentorApplication1, mentorApplication2, mentorApplication3, + mentorApplication4, mentorApplication5, mentorApplication6 + ); + + // when + Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); + + // then + assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); + assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)); + assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().universitySelectType()) + .containsOnly(UniversitySelectType.CATALOG); + } + + @Test + void OTHER_타입의_멘토_지원서만_조회한다() { + // given + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(null, null, null, UniversitySelectType.OTHER); + Pageable pageable = PageRequest.of(0, 10); + List expectedMentorApplications = List.of(mentorApplication7, mentorApplication8); + + // when + Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); + + // then + assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); + assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)); + assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().universitySelectType()) + .containsOnly(UniversitySelectType.OTHER); + } + @Test void 모든_조건으로_페이징하여_조회한다() { // given String regionKoreanName = "영미권"; - MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(MentorApplicationStatus.PENDING, regionKoreanName, LocalDate.now()); + MentorApplicationSearchCondition condition = new MentorApplicationSearchCondition(MentorApplicationStatus.PENDING, regionKoreanName, LocalDate.now(), UniversitySelectType.CATALOG); Pageable pageable = PageRequest.of(0, 10); List expectedMentorApplications = List.of(mentorApplication2); @@ -347,8 +400,8 @@ class 멘토_지원서_상태별_개수_조회 { void 상태별_멘토_지원서_개수를_조회한다() { // given List expectedApprovedCount = List.of(mentorApplication1, mentorApplication4); - List expectedPendingCount = List.of(mentorApplication2, mentorApplication5); - List expectedRejectedCount = List.of(mentorApplication3, mentorApplication6); + List expectedPendingCount = List.of(mentorApplication2, mentorApplication5, mentorApplication7); + List expectedRejectedCount = List.of(mentorApplication3, mentorApplication6, mentorApplication8); // when MentorApplicationCountResponse response = adminMentorApplicationService.getMentorApplicationCount(); From 536c4c650c329c84be18d451df453692a70a70db Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Sun, 14 Dec 2025 15:38:09 +0900 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=EB=A9=98=ED=86=A0=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=EC=84=9C=EC=97=90=20=EB=8C=80=ED=95=99=20=EB=A7=A4?= =?UTF-8?q?=ED=95=91=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminMentorApplicationController.java | 11 ++++++++ ...torApplicationAssignUniversityRequest.java | 10 +++++++ .../AdminMentorApplicationService.java | 28 ++++++++++++++++++- .../common/exception/ErrorCode.java | 1 + .../mentor/domain/MentorApplication.java | 6 ++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/example/solidconnection/admin/dto/MentorApplicationAssignUniversityRequest.java diff --git a/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java b/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java index 1c64df14..c201b8f0 100644 --- a/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java +++ b/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java @@ -1,5 +1,6 @@ package com.example.solidconnection.admin.controller; +import com.example.solidconnection.admin.dto.MentorApplicationAssignUniversityRequest; import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; import com.example.solidconnection.admin.dto.MentorApplicationRejectRequest; import com.example.solidconnection.admin.dto.MentorApplicationSearchCondition; @@ -62,4 +63,14 @@ public ResponseEntity getMentorApplicationCount( MentorApplicationCountResponse response = adminMentorApplicationService.getMentorApplicationCount(); return ResponseEntity.ok(response); } + + @PostMapping("/{mentorApplicationId}/assign-university") + public ResponseEntity assignUniversity( + @PathVariable("mentorApplicationId") Long mentorApplicationId, + @Valid @RequestBody MentorApplicationAssignUniversityRequest request + ) { + Long universityId = request.universityId(); + adminMentorApplicationService.assignUniversity(mentorApplicationId, universityId); + return ResponseEntity.ok().build(); + } } diff --git a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationAssignUniversityRequest.java b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationAssignUniversityRequest.java new file mode 100644 index 00000000..6fdd8c6e --- /dev/null +++ b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationAssignUniversityRequest.java @@ -0,0 +1,10 @@ +package com.example.solidconnection.admin.dto; + +import jakarta.validation.constraints.NotNull; + +public record MentorApplicationAssignUniversityRequest( + @NotNull(message = "대학 ID 는 필수입니다.") + Long universityId +) { + +} diff --git a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java index 2c8ab494..13e208b9 100644 --- a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java +++ b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java @@ -1,7 +1,9 @@ package com.example.solidconnection.admin.service; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_FOUND; +import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; +import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND; import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; import com.example.solidconnection.admin.dto.MentorApplicationRejectRequest; @@ -10,7 +12,10 @@ import com.example.solidconnection.common.exception.CustomException; import com.example.solidconnection.mentor.domain.MentorApplication; import com.example.solidconnection.mentor.domain.MentorApplicationStatus; +import com.example.solidconnection.mentor.domain.UniversitySelectType; import com.example.solidconnection.mentor.repository.MentorApplicationRepository; +import com.example.solidconnection.university.domain.University; +import com.example.solidconnection.university.repository.UniversityRepository; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -22,6 +27,7 @@ public class AdminMentorApplicationService { private final MentorApplicationRepository mentorApplicationRepository; + private final UniversityRepository universityRepository; @Transactional(readOnly = true) public Page searchMentorApplications( @@ -44,7 +50,10 @@ public void approveMentorApplication(Long mentorApplicationId) { } @Transactional - public void rejectMentorApplication(long mentorApplicationId, MentorApplicationRejectRequest request) { + public void rejectMentorApplication( + long mentorApplicationId, + MentorApplicationRejectRequest request + ) { MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); @@ -63,4 +72,21 @@ public MentorApplicationCountResponse getMentorApplicationCount() { rejectedCount ); } + + @Transactional + public void assignUniversity( + Long mentorApplicationId, + Long universityId + ) { + MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) + .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); + + if(mentorApplication.getUniversitySelectType() != UniversitySelectType.OTHER){ + throw new CustomException(MENTOR_APPLICATION_NOT_OTHER_STATUS); + } + + University university = universityRepository.getUniversityById(universityId); + + mentorApplication.assignUniversity(university.getId()); + } } diff --git a/src/main/java/com/example/solidconnection/common/exception/ErrorCode.java b/src/main/java/com/example/solidconnection/common/exception/ErrorCode.java index a1837d30..0ca6ef61 100644 --- a/src/main/java/com/example/solidconnection/common/exception/ErrorCode.java +++ b/src/main/java/com/example/solidconnection/common/exception/ErrorCode.java @@ -131,6 +131,7 @@ public enum ErrorCode { MENTOR_ALREADY_EXISTS(HttpStatus.BAD_REQUEST.value(), "이미 존재하는 멘토입니다."), MENTOR_APPLICATION_ALREADY_CONFIRMED(HttpStatus.BAD_REQUEST.value(), "이미 승인 또는 거절된 멘토 승격 요청 입니다."), MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED(HttpStatus.BAD_REQUEST.value(), "승인하려는 멘토 신청에 대학교가 선택되지 않았습니다."), + MENTOR_APPLICATION_NOT_OTHER_STATUS(HttpStatus.BAD_REQUEST.value(), "대학 선택 타입이 OTHER이 아닌 멘토 지원서 입니다."), // socket UNAUTHORIZED_SUBSCRIBE(HttpStatus.FORBIDDEN.value(), "구독 권한이 없습니다."), diff --git a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java index 502ae123..955ba7c1 100644 --- a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java +++ b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java @@ -8,6 +8,7 @@ import com.example.solidconnection.common.exception.CustomException; import com.example.solidconnection.common.exception.ErrorCode; import com.example.solidconnection.siteuser.domain.ExchangeStatus; +import com.example.solidconnection.university.domain.University; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; @@ -136,4 +137,9 @@ public void reject(String rejectedReason){ this.mentorApplicationStatus = MentorApplicationStatus.REJECTED; this.rejectedReason = rejectedReason; } + + public void assignUniversity(long universityId) { + this.universityId = universityId; + this.universitySelectType = UniversitySelectType.CATALOG; + } } From d6862f72a3ccf2e80444365204daff264905eaa0 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Sun, 14 Dec 2025 16:02:30 +0900 Subject: [PATCH 5/9] =?UTF-8?q?test:=20=EB=A9=98=ED=86=A0=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=EC=84=9C=20=EB=8C=80=ED=95=99=20=EB=A7=A4=ED=95=91=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminMentorApplicationServiceTest.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java index b321299b..860e70c8 100644 --- a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java +++ b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java @@ -2,7 +2,9 @@ import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_ALREADY_CONFIRMED; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_FOUND; +import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; +import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode; import static org.junit.jupiter.api.Assertions.assertAll; @@ -430,4 +432,59 @@ class 멘토_지원서_상태별_개수_조회 { ); } } + + @Nested + class 멘토_지원서에_대학_매핑 { + + @Test + void OTHER_타입의_멘토_지원서에_대학을_매핑하면_대학이_할당되고_타입이_CATALOG로_변경된다() { + // given + long otherTypeMentorApplicationId = mentorApplication7.getId(); + University university = universityFixture.메이지_대학(); + + // when + adminMentorApplicationService.assignUniversity(otherTypeMentorApplicationId, university.getId()); + + // then + MentorApplication result = mentorApplicationRepository.findById(otherTypeMentorApplicationId).get(); + assertThat(result.getUniversityId()).isEqualTo(university.getId()); + assertThat(result.getUniversitySelectType()).isEqualTo(UniversitySelectType.CATALOG); + } + + @Test + void 존재하지_않는_멘토_지원서에_대학을_매핑하면_예외_응답을_반환한다() { + // given + long nonExistentId = 99999L; + University university = universityFixture.메이지_대학(); + + // when & then + assertThatCode(() -> adminMentorApplicationService.assignUniversity(nonExistentId, university.getId())) + .isInstanceOf(CustomException.class) + .hasMessage(MENTOR_APPLICATION_NOT_FOUND.getMessage()); + } + + @Test + void CATALOG_타입의_멘토_지원서에_대학을_매핑하면_예외_응답을_반환한다() { + // given + long catalogTypeMentorApplicationId = mentorApplication2.getId(); + University university = universityFixture.메이지_대학(); + + // when & then + assertThatCode(() -> adminMentorApplicationService.assignUniversity(catalogTypeMentorApplicationId, university.getId())) + .isInstanceOf(CustomException.class) + .hasMessage(MENTOR_APPLICATION_NOT_OTHER_STATUS.getMessage()); + } + + @Test + void 존재하지_않는_대학을_매핑하면_예외_응답을_반환한다() { + // given + long otherTypeMentorApplicationId = mentorApplication7.getId(); + long nonExistentUniversityId = 99999L; + + // when & then + assertThatCode(() -> adminMentorApplicationService.assignUniversity(otherTypeMentorApplicationId, nonExistentUniversityId)) + .isInstanceOf(CustomException.class) + .hasMessage(UNIVERSITY_NOT_FOUND.getMessage()); + } + } } From 7858e26b2b35122647ea36896a3c084674be0f62 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Fri, 19 Dec 2025 17:18:28 +0900 Subject: [PATCH 6/9] =?UTF-8?q?refactor:=20=EC=9D=98=EB=AF=B8=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20import=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/AdminMentorApplicationService.java | 1 - .../example/solidconnection/mentor/domain/MentorApplication.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java index 13e208b9..352dd955 100644 --- a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java +++ b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java @@ -3,7 +3,6 @@ import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_FOUND; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; -import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND; import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; import com.example.solidconnection.admin.dto.MentorApplicationRejectRequest; diff --git a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java index 955ba7c1..8083000f 100644 --- a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java +++ b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java @@ -8,7 +8,6 @@ import com.example.solidconnection.common.exception.CustomException; import com.example.solidconnection.common.exception.ErrorCode; import com.example.solidconnection.siteuser.domain.ExchangeStatus; -import com.example.solidconnection.university.domain.University; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; From 56808c2f90a9e252a9f90b80b1151c96e98b1ae7 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Thu, 25 Dec 2025 01:08:36 +0900 Subject: [PATCH 7/9] =?UTF-8?q?refactor:=20=EB=A6=AC=EB=B7=B0=20=EB=82=B4?= =?UTF-8?q?=EC=9A=A9=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 개행 및 공백 추가 * refactor: pathVariable 네이밍을 kebab-case 로 통일 --- .../controller/AdminMentorApplicationController.java | 12 ++++++------ .../admin/dto/MentorApplicationSearchCondition.java | 2 +- .../admin/service/AdminMentorApplicationService.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java b/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java index c201b8f0..b8fe6974 100644 --- a/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java +++ b/src/main/java/com/example/solidconnection/admin/controller/AdminMentorApplicationController.java @@ -41,17 +41,17 @@ public ResponseEntity> searchMento return ResponseEntity.ok(PageResponse.of(page)); } - @PostMapping("/{mentorApplicationId}/approve") + @PostMapping("/{mentor-application-id}/approve") public ResponseEntity approveMentorApplication( - @PathVariable("mentorApplicationId") Long mentorApplicationId + @PathVariable("mentor-application-id") Long mentorApplicationId ) { adminMentorApplicationService.approveMentorApplication(mentorApplicationId); return ResponseEntity.ok().build(); } - @PostMapping("/{mentorApplicationId}/reject") + @PostMapping("/{mentor-application-id}/reject") public ResponseEntity rejectMentorApplication( - @PathVariable("mentorApplicationId") Long mentorApplicationId, + @PathVariable("mentor-application-id") Long mentorApplicationId, @Valid @RequestBody MentorApplicationRejectRequest request ) { adminMentorApplicationService.rejectMentorApplication(mentorApplicationId, request); @@ -64,9 +64,9 @@ public ResponseEntity getMentorApplicationCount( return ResponseEntity.ok(response); } - @PostMapping("/{mentorApplicationId}/assign-university") + @PostMapping("/{mentor-application-id}/assign-university") public ResponseEntity assignUniversity( - @PathVariable("mentorApplicationId") Long mentorApplicationId, + @PathVariable("mentor-application-id") Long mentorApplicationId, @Valid @RequestBody MentorApplicationAssignUniversityRequest request ) { Long universityId = request.universityId(); diff --git a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java index 0f987d91..940d2369 100644 --- a/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java +++ b/src/main/java/com/example/solidconnection/admin/dto/MentorApplicationSearchCondition.java @@ -11,4 +11,4 @@ public record MentorApplicationSearchCondition( UniversitySelectType universitySelectType ) { -} \ No newline at end of file +} diff --git a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java index 352dd955..6b978410 100644 --- a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java +++ b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java @@ -80,7 +80,7 @@ public void assignUniversity( MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); - if(mentorApplication.getUniversitySelectType() != UniversitySelectType.OTHER){ + if (mentorApplication.getUniversitySelectType() != UniversitySelectType.OTHER){ throw new CustomException(MENTOR_APPLICATION_NOT_OTHER_STATUS); } From 4d23a495ae708e687124de8ae9db6221f2169d63 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Fri, 26 Dec 2025 17:37:14 +0900 Subject: [PATCH 8/9] =?UTF-8?q?refactor:=20Service=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=EC=9D=98=20=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=EC=9D=84=20=EB=8F=84=EB=A9=94=EC=9D=B8=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: PENDING 상태 및 OTHER 타입 검증을 도메인 메서드로 관리 * refactor: assignUniversity() 호출 전 검증 책임을 도메인 엔티티에 위임 --- .../AdminMentorApplicationService.java | 11 +------ .../mentor/domain/MentorApplication.java | 30 +++++++++++++++---- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java index 6b978410..d22d9af7 100644 --- a/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java +++ b/src/main/java/com/example/solidconnection/admin/service/AdminMentorApplicationService.java @@ -1,8 +1,6 @@ package com.example.solidconnection.admin.service; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_FOUND; -import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; -import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; import com.example.solidconnection.admin.dto.MentorApplicationRejectRequest; @@ -11,7 +9,6 @@ import com.example.solidconnection.common.exception.CustomException; import com.example.solidconnection.mentor.domain.MentorApplication; import com.example.solidconnection.mentor.domain.MentorApplicationStatus; -import com.example.solidconnection.mentor.domain.UniversitySelectType; import com.example.solidconnection.mentor.repository.MentorApplicationRepository; import com.example.solidconnection.university.domain.University; import com.example.solidconnection.university.repository.UniversityRepository; @@ -41,10 +38,6 @@ public void approveMentorApplication(Long mentorApplicationId) { MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); - if(mentorApplication.getUniversityId() == null){ - throw new CustomException(MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED); - } - mentorApplication.approve(); } @@ -80,9 +73,7 @@ public void assignUniversity( MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); - if (mentorApplication.getUniversitySelectType() != UniversitySelectType.OTHER){ - throw new CustomException(MENTOR_APPLICATION_NOT_OTHER_STATUS); - } + mentorApplication.validateCanAssignUniversity(); University university = universityRepository.getUniversityById(universityId); diff --git a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java index 8083000f..fe4f2ccb 100644 --- a/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java +++ b/src/main/java/com/example/solidconnection/mentor/domain/MentorApplication.java @@ -1,6 +1,8 @@ package com.example.solidconnection.mentor.domain; import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_ALREADY_CONFIRMED; +import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; +import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; import static java.time.ZoneOffset.UTC; import static java.time.temporal.ChronoUnit.MICROS; @@ -122,17 +124,20 @@ private void validateExchangeStatus(ExchangeStatus exchangeStatus) { } public void approve(){ - if(this.mentorApplicationStatus != MentorApplicationStatus.PENDING) { - throw new CustomException(MENTOR_APPLICATION_ALREADY_CONFIRMED); - } + validatePending(); + validateCanApprove(); this.mentorApplicationStatus = MentorApplicationStatus.APPROVED; this.approvedAt = ZonedDateTime.now(UTC).truncatedTo(MICROS); } - public void reject(String rejectedReason){ - if(this.mentorApplicationStatus != MentorApplicationStatus.PENDING) { - throw new CustomException(MENTOR_APPLICATION_ALREADY_CONFIRMED); + private void validateCanApprove(){ + if(this.universitySelectType != UniversitySelectType.CATALOG){ + throw new CustomException(MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED); } + } + + public void reject(String rejectedReason){ + validatePending(); this.mentorApplicationStatus = MentorApplicationStatus.REJECTED; this.rejectedReason = rejectedReason; } @@ -141,4 +146,17 @@ public void assignUniversity(long universityId) { this.universityId = universityId; this.universitySelectType = UniversitySelectType.CATALOG; } + + public void validateCanAssignUniversity(){ + validatePending(); + if(this.universitySelectType != UniversitySelectType.OTHER){ + throw new CustomException(MENTOR_APPLICATION_NOT_OTHER_STATUS); + } + } + + private void validatePending(){ + if(this.mentorApplicationStatus != MentorApplicationStatus.PENDING) { + throw new CustomException(MENTOR_APPLICATION_ALREADY_CONFIRMED); + } + } } From 7df44a058d17635be1599cd23471d59c9d3e7d20 Mon Sep 17 00:00:00 2001 From: sukangpunch Date: Fri, 26 Dec 2025 18:18:03 +0900 Subject: [PATCH 9/9] =?UTF-8?q?test=20:=20assertAll=20=EB=A1=9C=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EA=B7=B8=EB=A3=B9=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminMentorApplicationServiceTest.java | 184 ++++++++++-------- 1 file changed, 103 insertions(+), 81 deletions(-) diff --git a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java index 860e70c8..ae40cb5d 100644 --- a/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java +++ b/src/test/java/com/example/solidconnection/admin/service/AdminMentorApplicationServiceTest.java @@ -100,15 +100,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().mentorApplicationStatus()) - .containsOnly(MentorApplicationStatus.PENDING); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().mentorApplicationStatus()) + .containsOnly(MentorApplicationStatus.PENDING) + ); } @Test @@ -123,15 +125,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.siteUserResponse().nickname()) - .containsOnly(nickname); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.siteUserResponse().nickname()) + .containsOnly(nickname) + ); } @Test @@ -146,15 +150,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().university()) - .containsOnly(universityKoreanName); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().university()) + .containsOnly(universityKoreanName) + ); } @Test @@ -169,15 +175,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().region()) - .containsOnly(regionKoreanName); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().region()) + .containsOnly(regionKoreanName) + ); } @Test @@ -192,15 +200,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().country()) - .containsOnly(countryKoreanName); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().country()) + .containsOnly(countryKoreanName) + ); } @Test @@ -217,15 +227,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().universitySelectType()) - .containsOnly(UniversitySelectType.CATALOG); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().universitySelectType()) + .containsOnly(UniversitySelectType.CATALOG) + ); } @Test @@ -239,15 +251,17 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().universitySelectType()) - .containsOnly(UniversitySelectType.OTHER); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().universitySelectType()) + .containsOnly(UniversitySelectType.OTHER) + ); } @Test @@ -262,18 +276,20 @@ class 멘토_승격_지원서_목록_조회 { Page response = adminMentorApplicationService.searchMentorApplications(condition, pageable); // then - assertThat(response.getContent()).hasSize(expectedMentorApplications.size()); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().id()) - .containsOnly(expectedMentorApplications.stream() - .map(MentorApplication::getId) - .toArray(Long[]::new)); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().mentorApplicationStatus()) - .containsOnly(MentorApplicationStatus.PENDING); - assertThat(response.getContent()) - .extracting(content -> content.mentorApplicationResponse().region()) - .containsOnly(regionKoreanName); + assertAll( + () -> assertThat(response.getContent()).hasSize(expectedMentorApplications.size()), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().id()) + .containsOnly(expectedMentorApplications.stream() + .map(MentorApplication::getId) + .toArray(Long[]::new)), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().mentorApplicationStatus()) + .containsOnly(MentorApplicationStatus.PENDING), + () -> assertThat(response.getContent()) + .extracting(content -> content.mentorApplicationResponse().region()) + .containsOnly(regionKoreanName) + ); } } @@ -290,8 +306,10 @@ class 멘토_승격_지원서_승인{ // then MentorApplication result = mentorApplicationRepository.findById(mentorApplication2.getId()).get(); - assertThat(result.getMentorApplicationStatus()).isEqualTo(MentorApplicationStatus.APPROVED); - assertThat(result.getApprovedAt()).isNotNull(); + assertAll( + () -> assertThat(result.getMentorApplicationStatus()).isEqualTo(MentorApplicationStatus.APPROVED), + () -> assertThat(result.getApprovedAt()).isNotNull() + ); } @Test @@ -354,8 +372,10 @@ class 멘토_승격_지원서_거절{ // then MentorApplication result = mentorApplicationRepository.findById(mentorApplication2.getId()).get(); - assertThat(result.getMentorApplicationStatus()).isEqualTo(MentorApplicationStatus.REJECTED); - assertThat(result.getRejectedReason()).isEqualTo(request.rejectedReason()); + assertAll( + () -> assertThat(result.getMentorApplicationStatus()).isEqualTo(MentorApplicationStatus.REJECTED), + () -> assertThat(result.getRejectedReason()).isEqualTo(request.rejectedReason()) + ); } @Test @@ -447,8 +467,10 @@ class 멘토_지원서에_대학_매핑 { // then MentorApplication result = mentorApplicationRepository.findById(otherTypeMentorApplicationId).get(); - assertThat(result.getUniversityId()).isEqualTo(university.getId()); - assertThat(result.getUniversitySelectType()).isEqualTo(UniversitySelectType.CATALOG); + assertAll( + () -> assertThat(result.getUniversityId()).isEqualTo(university.getId()), + () -> assertThat(result.getUniversitySelectType()).isEqualTo(UniversitySelectType.CATALOG) + ); } @Test