From 69b1c9f9ef8727e8a04a7054e19b0d804c31e063 Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 13 Apr 2024 23:29:02 +0900 Subject: [PATCH 1/5] =?UTF-8?q?RAC-341=20fix=20:=20=EC=A0=95=EC=82=B0=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EB=A9=98=ED=86=A0=EB=A7=81?= =?UTF-8?q?=EB=B3=84=20=EC=A0=95=EC=82=B0=20=EA=B8=88=EC=95=A1=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/repository/MentoringDslRepositoryImpl.java | 2 ++ .../domain/salary/application/mapper/SalaryMapper.java | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java index 9b104897..5f19335a 100644 --- a/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java @@ -102,6 +102,8 @@ public List findAllBySeniorAndSalaryStatus(Senior senior, Boolean sta mentoring.status.eq(Status.DONE), mentoring.salary.status.eq(status) ) + .leftJoin(mentoring.payment, payment) + .fetchJoin() .leftJoin(mentoring.salary, salary) .fetchJoin() .leftJoin(mentoring.user, user) diff --git a/src/main/java/com/postgraduate/domain/salary/application/mapper/SalaryMapper.java b/src/main/java/com/postgraduate/domain/salary/application/mapper/SalaryMapper.java index 5786db9a..9d9da974 100644 --- a/src/main/java/com/postgraduate/domain/salary/application/mapper/SalaryMapper.java +++ b/src/main/java/com/postgraduate/domain/salary/application/mapper/SalaryMapper.java @@ -11,8 +11,6 @@ import java.time.LocalDate; public class SalaryMapper { - private static final int AMOUNT = 20000; - private SalaryMapper() { throw new IllegalArgumentException(); } @@ -43,7 +41,7 @@ public static SalaryDetails mapToSalaryDetail(Mentoring mentoring) { user.getNickName(), mentoring.getDate(), mentoring.getTerm(), - AMOUNT, + mentoring.calculateForSenior(), salary.getSalaryDate() ); } From cc336b235a86809133d7b15312d53d8802592d01 Mon Sep 17 00:00:00 2001 From: yang Date: Sun, 14 Apr 2024 00:19:01 +0900 Subject: [PATCH 2/5] =?UTF-8?q?RAC-341=20fix=20:=20=EC=84=A0=EB=B0=B0=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20nul?= =?UTF-8?q?l=ED=8F=AC=ED=95=A8=20=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/senior/application/usecase/SeniorMyPageUseCase.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java index 86838c85..607b7d92 100644 --- a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java +++ b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java @@ -14,7 +14,6 @@ import com.postgraduate.domain.senior.domain.entity.Senior; import com.postgraduate.domain.senior.domain.entity.constant.Status; import com.postgraduate.domain.senior.domain.service.SeniorGetService; -import com.postgraduate.domain.senior.exception.NoneProfileException; import com.postgraduate.domain.user.domain.entity.User; import com.postgraduate.domain.wish.domain.entity.Wish; import com.postgraduate.domain.wish.domain.service.WishGetService; @@ -51,7 +50,7 @@ public SeniorMyPageResponse getSeniorInfo(User user) { public SeniorMyPageProfileResponse getSeniorMyPageProfile(User user) { Senior senior = seniorGetService.byUser(user); if (senior.getProfile() == null) { - throw new NoneProfileException(); + return mapToMyPageProfile(senior); } List availables = availableGetService.byMine(senior); List times = availables.stream() From cc396afebbf1ee5bbaefe3e4e0402d3b563ec549 Mon Sep 17 00:00:00 2001 From: yang Date: Sun, 14 Apr 2024 00:34:44 +0900 Subject: [PATCH 3/5] =?UTF-8?q?RAC-341=20test=20:=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/SeniorMyPageUseCaseTest.java | 22 +++++++++++++--- .../presentation/SeniorControllerTest.java | 25 ++++++++----------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java index 699be66e..8053c190 100644 --- a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java +++ b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java @@ -119,14 +119,30 @@ void getSeniorMyPageProfile() { } @Test - @DisplayName("선배 자신의 마이페이지 프로필 예외 테스트") + @DisplayName("선배 자신의 마이페이지 프로필 작성 이전 Info조회 테스트") void getSeniorMyPageProfileWithNull() { Senior nullSenior = new Senior(-2L, user, "asd", APPROVE, 1, info, null, LocalDateTime.now(), null); given(seniorGetService.byUser(user)) .willReturn(nullSenior); - assertThatThrownBy(() -> seniorMyPageUseCase.getSeniorMyPageProfile(user)) - .isInstanceOf(NoneProfileException.class); + SeniorMyPageProfileResponse myPageProfile = seniorMyPageUseCase.getSeniorMyPageProfile(user); + + assertThat(myPageProfile.lab()) + .isNotEmpty(); + assertThat(myPageProfile.field()) + .isNotEmpty(); + assertThat(myPageProfile.keyword()) + .isNotEmpty(); + assertThat(myPageProfile.info()) + .isNull(); + assertThat(myPageProfile.target()) + .isNull(); + assertThat(myPageProfile.chatLink()) + .isNull(); + assertThat(myPageProfile.oneLiner()) + .isNull(); + assertThat(myPageProfile.times()) + .isNull(); } @Test diff --git a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java index 7e62558f..86294733 100644 --- a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java +++ b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java @@ -303,20 +303,17 @@ void getSeniorProfile() throws Exception { void getEmptySeniorProfile() throws Exception { mvc.perform(get("/senior/me/profile") .header(AUTHORIZATION, BEARER + seniorToken)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.code").value(PROFILE_NOT_FOUND.getCode())) - .andExpect(jsonPath("$.message").value(NOT_FOUND_PROFILE.getMessage())); -// .andExpect(status().isOk()) -// .andExpect(jsonPath("$.code").value(SENIOR_FIND.getCode())) -// .andExpect(jsonPath("$.message").value(GET_SENIOR_MYPAGE_PROFILE.getMessage())) -// .andExpect(jsonPath("$.data.lab").isNotEmpty()) -// .andExpect(jsonPath("$.data.keyword").isNotEmpty()) -// .andExpect(jsonPath("$.data.info").isEmpty()) -// .andExpect(jsonPath("$.data.target").isEmpty()) -// .andExpect(jsonPath("$.data.chatLink").isEmpty()) -// .andExpect(jsonPath("$.data.field").isNotEmpty()) -// .andExpect(jsonPath("$.data.oneLiner").isEmpty()) -// .andExpect(jsonPath("$.data.times").isEmpty()); + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(SENIOR_FIND.getCode())) + .andExpect(jsonPath("$.message").value(GET_SENIOR_MYPAGE_PROFILE.getMessage())) + .andExpect(jsonPath("$.data.lab").isNotEmpty()) + .andExpect(jsonPath("$.data.keyword").isNotEmpty()) + .andExpect(jsonPath("$.data.info").isEmpty()) + .andExpect(jsonPath("$.data.target").isEmpty()) + .andExpect(jsonPath("$.data.chatLink").isEmpty()) + .andExpect(jsonPath("$.data.field").isNotEmpty()) + .andExpect(jsonPath("$.data.oneLiner").isEmpty()) + .andExpect(jsonPath("$.data.times").isEmpty()); } @Test From e94605aa8cf2564c15aa473a9699394cafef99da Mon Sep 17 00:00:00 2001 From: yang Date: Sun, 14 Apr 2024 04:01:02 +0900 Subject: [PATCH 4/5] =?UTF-8?q?RAC-341=20refactor=20:=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=20=EC=99=80=EC=9D=BC=EB=93=9C=20=EC=B9=B4=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/res/AppliedMentoringResponse.java | 6 ----- .../dto/res/DoneMentoringResponse.java | 8 +++++++ .../dto/res/DoneSeniorMentoringResponse.java | 8 +++++++ .../dto/res/ExpectedMentoringResponse.java | 8 +++++++ .../res/ExpectedSeniorMentoringResponse.java | 8 +++++++ .../dto/res/WaitingMentoringResponse.java | 8 +++++++ .../res/WaitingSeniorMentoringResponse.java | 8 +++++++ .../usecase/MentoringSeniorInfoUseCase.java | 15 ++++++------ .../usecase/MentoringUserInfoUseCase.java | 15 ++++++------ .../presentation/MentoringController.java | 24 +++++++++---------- 10 files changed, 74 insertions(+), 34 deletions(-) delete mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/AppliedMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneSeniorMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedSeniorMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingMentoringResponse.java create mode 100644 src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingSeniorMentoringResponse.java diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/AppliedMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/AppliedMentoringResponse.java deleted file mode 100644 index 1beca406..00000000 --- a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/AppliedMentoringResponse.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.postgraduate.domain.mentoring.application.dto.res; - -import java.util.List; - -public record AppliedMentoringResponse(List mentoringInfos) { -} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneMentoringResponse.java new file mode 100644 index 00000000..de474da7 --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.DoneMentoringInfo; + +import java.util.List; + +public record DoneMentoringResponse(List mentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneSeniorMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneSeniorMentoringResponse.java new file mode 100644 index 00000000..1659be69 --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/DoneSeniorMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.DoneSeniorMentoringInfo; + +import java.util.List; + +public record DoneSeniorMentoringResponse(List seniorMentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedMentoringResponse.java new file mode 100644 index 00000000..e232906e --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.ExpectedMentoringInfo; + +import java.util.List; + +public record ExpectedMentoringResponse(List mentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedSeniorMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedSeniorMentoringResponse.java new file mode 100644 index 00000000..19a797db --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/ExpectedSeniorMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.ExpectedSeniorMentoringInfo; + +import java.util.List; + +public record ExpectedSeniorMentoringResponse(List seniorMentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingMentoringResponse.java new file mode 100644 index 00000000..0c385c0c --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.WaitingMentoringInfo; + +import java.util.List; + +public record WaitingMentoringResponse(List mentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingSeniorMentoringResponse.java b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingSeniorMentoringResponse.java new file mode 100644 index 00000000..54d4b4c4 --- /dev/null +++ b/src/main/java/com/postgraduate/domain/mentoring/application/dto/res/WaitingSeniorMentoringResponse.java @@ -0,0 +1,8 @@ +package com.postgraduate.domain.mentoring.application.dto.res; + +import com.postgraduate.domain.mentoring.application.dto.WaitingSeniorMentoringInfo; + +import java.util.List; + +public record WaitingSeniorMentoringResponse(List seniorMentoringInfos) { +} diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCase.java b/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCase.java index a832e55e..589bcbbd 100644 --- a/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCase.java +++ b/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCase.java @@ -3,8 +3,7 @@ import com.postgraduate.domain.mentoring.application.dto.DoneSeniorMentoringInfo; import com.postgraduate.domain.mentoring.application.dto.ExpectedSeniorMentoringInfo; import com.postgraduate.domain.mentoring.application.dto.WaitingSeniorMentoringInfo; -import com.postgraduate.domain.mentoring.application.dto.res.SeniorMentoringDetailResponse; -import com.postgraduate.domain.mentoring.application.dto.res.SeniorMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.*; import com.postgraduate.domain.mentoring.application.mapper.MentoringMapper; import com.postgraduate.domain.mentoring.domain.entity.Mentoring; import com.postgraduate.domain.mentoring.domain.service.MentoringGetService; @@ -35,7 +34,7 @@ public SeniorMentoringDetailResponse getSeniorMentoringDetail(User user, Long me return mapToSeniorMentoringDetail(mentoring); } - public SeniorMentoringResponse getSeniorWaiting(User user) { + public WaitingSeniorMentoringResponse getSeniorWaiting(User user) { Senior senior = seniorGetService.byUser(user); List mentorings = mentoringGetService.bySeniorWaiting(senior); List waitingMentoringInfos = mentorings.stream() @@ -49,10 +48,10 @@ public SeniorMentoringResponse getSeniorWaiting(User user) { return mapToSeniorWaitingInfo(mentoring, remain); }) .toList(); - return new SeniorMentoringResponse(waitingMentoringInfos); + return new WaitingSeniorMentoringResponse(waitingMentoringInfos); } - public SeniorMentoringResponse getSeniorExpected(User user) { + public ExpectedSeniorMentoringResponse getSeniorExpected(User user) { Senior senior = seniorGetService.byUser(user); List mentorings = mentoringGetService.bySeniorExpected(senior); List expectedMentoringInfos = mentorings.stream() @@ -63,15 +62,15 @@ public SeniorMentoringResponse getSeniorExpected(User user) { return mapToSeniorExpectedInfo(mentoring, dDay); }) .toList(); - return new SeniorMentoringResponse(expectedMentoringInfos); + return new ExpectedSeniorMentoringResponse(expectedMentoringInfos); } - public SeniorMentoringResponse getSeniorDone(User user) { + public DoneSeniorMentoringResponse getSeniorDone(User user) { Senior senior = seniorGetService.byUser(user); List mentorings = mentoringGetService.bySeniorDone(senior); List doneSeniorMentoringInfos = mentorings.stream() .map(MentoringMapper::mapToSeniorDoneInfo) .toList(); - return new SeniorMentoringResponse(doneSeniorMentoringInfos); + return new DoneSeniorMentoringResponse(doneSeniorMentoringInfos); } } diff --git a/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCase.java b/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCase.java index 44702795..f3dad7e9 100644 --- a/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCase.java +++ b/src/main/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCase.java @@ -3,8 +3,7 @@ import com.postgraduate.domain.mentoring.application.dto.DoneMentoringInfo; import com.postgraduate.domain.mentoring.application.dto.ExpectedMentoringInfo; import com.postgraduate.domain.mentoring.application.dto.WaitingMentoringInfo; -import com.postgraduate.domain.mentoring.application.dto.res.AppliedMentoringDetailResponse; -import com.postgraduate.domain.mentoring.application.dto.res.AppliedMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.*; import com.postgraduate.domain.mentoring.application.mapper.MentoringMapper; import com.postgraduate.domain.mentoring.domain.entity.Mentoring; import com.postgraduate.domain.mentoring.domain.service.MentoringGetService; @@ -28,27 +27,27 @@ public AppliedMentoringDetailResponse getMentoringDetail(User user, Long mentori return mapToAppliedDetailInfo(mentoring); } - public AppliedMentoringResponse getWaiting(User user) { + public WaitingMentoringResponse getWaiting(User user) { List mentorings = mentoringGetService.byUserWaiting(user); List waitingMentoringInfos = mentorings.stream() .map(MentoringMapper::mapToWaitingInfo) .toList(); - return new AppliedMentoringResponse(waitingMentoringInfos); + return new WaitingMentoringResponse(waitingMentoringInfos); } - public AppliedMentoringResponse getExpected(User user) { + public ExpectedMentoringResponse getExpected(User user) { List mentorings = mentoringGetService.byUserExpected(user); List expectedMentoringInfos = mentorings.stream() .map(MentoringMapper::mapToExpectedInfo) .toList(); - return new AppliedMentoringResponse(expectedMentoringInfos); + return new ExpectedMentoringResponse(expectedMentoringInfos); } - public AppliedMentoringResponse getDone(User user) { + public DoneMentoringResponse getDone(User user) { List mentorings = mentoringGetService.byUserDone(user); List doneMentoringInfos = mentorings.stream() .map(MentoringMapper::mapToDoneInfo) .toList(); - return new AppliedMentoringResponse(doneMentoringInfos); + return new DoneMentoringResponse(doneMentoringInfos); } } diff --git a/src/main/java/com/postgraduate/domain/mentoring/presentation/MentoringController.java b/src/main/java/com/postgraduate/domain/mentoring/presentation/MentoringController.java index 67cec5f5..a5a9c625 100644 --- a/src/main/java/com/postgraduate/domain/mentoring/presentation/MentoringController.java +++ b/src/main/java/com/postgraduate/domain/mentoring/presentation/MentoringController.java @@ -30,22 +30,22 @@ public class MentoringController { @GetMapping("/me/waiting") @Operation(summary = "[대학생] 신청한 멘토링 목록 조회", description = "대학생이 신청한 멘토링 목록을 조회합니다.") - public ResponseDto getWaitingMentorings(@AuthenticationPrincipal User user) { - AppliedMentoringResponse mentoringResponse = userInfoUseCase.getWaiting(user); + public ResponseDto getWaitingMentorings(@AuthenticationPrincipal User user) { + WaitingMentoringResponse mentoringResponse = userInfoUseCase.getWaiting(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } @GetMapping("/me/expected") @Operation(summary = "[대학생] 예정된 멘토링 목록 조회", description = "대학생이 예정된 멘토링 목록을 조회합니다.") - public ResponseDto getExpectedMentorings(@AuthenticationPrincipal User user) { - AppliedMentoringResponse mentoringResponse = userInfoUseCase.getExpected(user); + public ResponseDto getExpectedMentorings(@AuthenticationPrincipal User user) { + ExpectedMentoringResponse mentoringResponse = userInfoUseCase.getExpected(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } @GetMapping("/me/done") @Operation(summary = "[대학생] 완료한 멘토링 목록 조회", description = "대학생이 완료한 멘토링 목록을 조회합니다.") - public ResponseDto getDoneMentorings(@AuthenticationPrincipal User user) { - AppliedMentoringResponse mentoringResponse = userInfoUseCase.getDone(user); + public ResponseDto getDoneMentorings(@AuthenticationPrincipal User user) { + DoneMentoringResponse mentoringResponse = userInfoUseCase.getDone(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } @@ -81,22 +81,22 @@ public ResponseDto updateMentoringCancel(@AuthenticationPrincipal User use @GetMapping("/senior/me/waiting") @Operation(summary = "[대학원생] 신청받은 확정대기 멘토링 목록 조회", description = "대학원생이 신청받은 확정대기 상태의 멘토링 목록을 조회합니다.") - public ResponseDto getSeniorWaitingMentorings(@AuthenticationPrincipal User user) { - SeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorWaiting(user); + public ResponseDto getSeniorWaitingMentorings(@AuthenticationPrincipal User user) { + WaitingSeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorWaiting(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } @GetMapping("/senior/me/expected") @Operation(summary = "[대학원생] 신청받은 예정된 멘토링 목록 조회", description = "대학원생이 신청받은 예정 상태의 멘토링 목록을 조회합니다.") - public ResponseDto getSeniorExpectedMentorings(@AuthenticationPrincipal User user) { - SeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorExpected(user); + public ResponseDto getSeniorExpectedMentorings(@AuthenticationPrincipal User user) { + ExpectedSeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorExpected(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } @GetMapping("/senior/me/done") @Operation(summary = "[대학원생] 신청받은 완료된 멘토링 목록 조회", description = "대학원생이 신청받은 완료 상태의 멘토링 목록을 조회합니다.") - public ResponseDto getSeniorDoneMentorings(@AuthenticationPrincipal User user) { - SeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorDone(user); + public ResponseDto getSeniorDoneMentorings(@AuthenticationPrincipal User user) { + DoneSeniorMentoringResponse mentoringResponse = seniorInfoUseCase.getSeniorDone(user); return ResponseDto.create(MENTORING_FIND.getCode(), GET_MENTORING_LIST_INFO.getMessage(), mentoringResponse); } From e13b06de2c9e161ad46b453f1da514c61cbf7486 Mon Sep 17 00:00:00 2001 From: yang Date: Sun, 14 Apr 2024 04:40:51 +0900 Subject: [PATCH 5/5] =?UTF-8?q?RAC-341=20test=20:=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/MentoringSeniorInfoUseCaseTest.java | 14 +++++++------- .../usecase/MentoringUserInfoUseCaseTest.java | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCaseTest.java b/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCaseTest.java index 20e94352..81ff1f3c 100644 --- a/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCaseTest.java +++ b/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringSeniorInfoUseCaseTest.java @@ -1,14 +1,14 @@ package com.postgraduate.domain.mentoring.application.usecase; -import com.postgraduate.domain.account.domain.entity.Account; -import com.postgraduate.domain.mentoring.application.dto.res.SeniorMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.DoneSeniorMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.ExpectedSeniorMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.WaitingSeniorMentoringResponse; import com.postgraduate.domain.mentoring.domain.entity.Mentoring; import com.postgraduate.domain.mentoring.domain.service.MentoringGetService; import com.postgraduate.domain.mentoring.exception.MentoringNotFoundException; import com.postgraduate.domain.payment.domain.entity.Payment; import com.postgraduate.domain.payment.domain.entity.constant.Status; import com.postgraduate.domain.salary.domain.entity.Salary; -import com.postgraduate.domain.salary.domain.service.SalaryGetService; import com.postgraduate.domain.senior.domain.entity.Info; import com.postgraduate.domain.senior.domain.entity.Profile; import com.postgraduate.domain.senior.domain.entity.Senior; @@ -26,7 +26,7 @@ import java.time.LocalDateTime; import java.util.List; -import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.*; +import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.WAITING; import static com.postgraduate.domain.senior.domain.entity.constant.Status.APPROVE; import static com.postgraduate.domain.user.domain.entity.constant.Role.SENIOR; import static com.postgraduate.domain.user.domain.entity.constant.Role.USER; @@ -115,7 +115,7 @@ void getSeniorWaiting() { given(mentoringGetService.bySeniorWaiting(senior)) .willReturn(mentorings); - SeniorMentoringResponse seniorWaiting = mentoringSeniorInfoUseCase.getSeniorWaiting(user); + WaitingSeniorMentoringResponse seniorWaiting = mentoringSeniorInfoUseCase.getSeniorWaiting(user); assertThat(seniorWaiting.seniorMentoringInfos()) .hasSameSizeAs(mentorings); @@ -138,7 +138,7 @@ void getSeniorExpected() { given(mentoringGetService.bySeniorExpected(senior)) .willReturn(mentorings); - SeniorMentoringResponse seniorExpected = mentoringSeniorInfoUseCase.getSeniorExpected(user); + ExpectedSeniorMentoringResponse seniorExpected = mentoringSeniorInfoUseCase.getSeniorExpected(user); assertThat(seniorExpected.seniorMentoringInfos()) .hasSameSizeAs(mentorings); @@ -165,7 +165,7 @@ void getSeniorDone() { given(mentoringGetService.bySeniorDone(senior)) .willReturn(mentorings); - SeniorMentoringResponse seniorDone = mentoringSeniorInfoUseCase.getSeniorDone(user); + DoneSeniorMentoringResponse seniorDone = mentoringSeniorInfoUseCase.getSeniorDone(user); assertThat(seniorDone.seniorMentoringInfos()) .hasSameSizeAs(mentorings); diff --git a/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCaseTest.java b/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCaseTest.java index cc1dfe37..1657d0f9 100644 --- a/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCaseTest.java +++ b/src/test/java/com/postgraduate/domain/mentoring/application/usecase/MentoringUserInfoUseCaseTest.java @@ -1,9 +1,10 @@ package com.postgraduate.domain.mentoring.application.usecase; -import com.postgraduate.domain.mentoring.application.dto.res.AppliedMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.DoneMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.ExpectedMentoringResponse; +import com.postgraduate.domain.mentoring.application.dto.res.WaitingMentoringResponse; import com.postgraduate.domain.mentoring.domain.entity.Mentoring; import com.postgraduate.domain.mentoring.domain.service.MentoringGetService; -import com.postgraduate.domain.mentoring.exception.MentoringDetailNotFoundException; import com.postgraduate.domain.mentoring.exception.MentoringNotFoundException; import com.postgraduate.domain.payment.domain.entity.Payment; import com.postgraduate.domain.payment.domain.entity.constant.Status; @@ -32,9 +33,7 @@ import static java.lang.Boolean.TRUE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) class MentoringUserInfoUseCaseTest { @@ -112,7 +111,7 @@ void getWaiting() { given(mentoringGetService.byUserWaiting(user)) .willReturn(mentorings); - AppliedMentoringResponse waiting = mentoringUserInfoUseCase.getWaiting(user); + WaitingMentoringResponse waiting = mentoringUserInfoUseCase.getWaiting(user); assertThat(waiting.mentoringInfos()) .hasSameSizeAs(mentorings); @@ -138,7 +137,7 @@ void getExpected() { given(mentoringGetService.byUserExpected(user)) .willReturn(mentorings); - AppliedMentoringResponse expected = mentoringUserInfoUseCase.getExpected(user); + ExpectedMentoringResponse expected = mentoringUserInfoUseCase.getExpected(user); assertThat(expected.mentoringInfos()) .hasSameSizeAs(mentorings); @@ -164,7 +163,7 @@ void getDone() { given(mentoringGetService.byUserDone(user)) .willReturn(mentorings); - AppliedMentoringResponse done = mentoringUserInfoUseCase.getDone(user); + DoneMentoringResponse done = mentoringUserInfoUseCase.getDone(user); assertThat(done.mentoringInfos()) .hasSameSizeAs(mentorings);