From 941d999a07bdd7f2df746e047ae26419bd99daf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B0=EC=A4=80=EC=9D=BC=28Bae=20Junil=29?= <70627982+bjo6300@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:25:55 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B4=89=EC=82=AC=EC=9E=90?= =?UTF-8?q?=EA=B0=80=20=EC=8B=A0=EC=B2=AD=ED=95=9C=20=EB=B4=89=EC=82=AC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0=ED=9A=8C(=EB=B4=89?= =?UTF-8?q?=EC=82=AC=EC=9E=90)=EB=A5=BC=20=EB=AA=85=EC=84=B8=EC=97=90=20?= =?UTF-8?q?=EB=A7=9E=EA=B2=8C=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4.=20(#?= =?UTF-8?q?161)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 응답 필드명을 수정한다. * refactor: FindApplyingVolunteerResponse에 shelterId를 추가한다. * refactor: isEqualTo(false)를 isFalse()로 변경한다. --- .../dto/FindApplyingVolunteersResponse.java | 10 ++++++---- .../controller/ApplicantControllerTest.java | 13 +++++++++---- .../repository/ApplicantRepositoryTest.java | 12 ++++++------ .../applicant/service/ApplicantServiceTest.java | 16 ++++++++-------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/clova/anifriends/domain/applicant/dto/FindApplyingVolunteersResponse.java b/src/main/java/com/clova/anifriends/domain/applicant/dto/FindApplyingVolunteersResponse.java index 2b7ab47c9..6f43c5452 100644 --- a/src/main/java/com/clova/anifriends/domain/applicant/dto/FindApplyingVolunteersResponse.java +++ b/src/main/java/com/clova/anifriends/domain/applicant/dto/FindApplyingVolunteersResponse.java @@ -10,19 +10,21 @@ public record FindApplyingVolunteersResponse( ) { public record FindApplyingVolunteerResponse( + Long shelterId, Long recruitmentId, Long applicantId, - String title, + String recruitmentTitle, String shelterName, - ApplicantStatus status, - boolean isWritedReview, - LocalDateTime volunteerDate + ApplicantStatus applicantStatus, + boolean applicantIsWritedReview, + LocalDateTime recruitmentStartTime ) { public static FindApplyingVolunteerResponse from( Applicant applicant ) { return new FindApplyingVolunteerResponse( + applicant.getRecruitment().getShelter().getShelterId(), applicant.getRecruitment().getRecruitmentId(), applicant.getApplicantId(), applicant.getRecruitment().getTitle(), diff --git a/src/test/java/com/clova/anifriends/domain/applicant/controller/ApplicantControllerTest.java b/src/test/java/com/clova/anifriends/domain/applicant/controller/ApplicantControllerTest.java index c717bf6e2..b4abf35b0 100644 --- a/src/test/java/com/clova/anifriends/domain/applicant/controller/ApplicantControllerTest.java +++ b/src/test/java/com/clova/anifriends/domain/applicant/controller/ApplicantControllerTest.java @@ -66,12 +66,14 @@ void registerApplicant() throws Exception { @DisplayName("findApplyingVolunteers 실행 시") void findApplyingVolunteers() throws Exception { // given + Long shelterId = 1L; Long volunteerId = 1L; Long recruitmentId = 1L; Long applicantShouldWriteReviewId = 1L; Long applicantShouldNotWriteReviewId = 2L; Shelter shelter = ShelterFixture.shelter(); + setField(shelter, "shelterId", shelterId); Volunteer volunteer = VolunteerFixture.volunteer(); setField(volunteer, "volunteerId", volunteerId); @@ -111,25 +113,28 @@ void findApplyingVolunteers() throws Exception { responseFields( fieldWithPath("findApplyingVolunteerResponses").type(JsonFieldType.ARRAY) .description("신청한 봉사 리스트"), + fieldWithPath("findApplyingVolunteerResponses[].shelterId").type( + JsonFieldType.NUMBER) + .description("보호소 ID"), fieldWithPath("findApplyingVolunteerResponses[].recruitmentId").type( JsonFieldType.NUMBER) .description("봉사 모집글 ID"), fieldWithPath("findApplyingVolunteerResponses[].applicantId").type( JsonFieldType.NUMBER) .description("봉사 신청자 ID"), - fieldWithPath("findApplyingVolunteerResponses[].title").type( + fieldWithPath("findApplyingVolunteerResponses[].recruitmentTitle").type( JsonFieldType.STRING) .description("모집글 제목"), fieldWithPath("findApplyingVolunteerResponses[].shelterName").type( JsonFieldType.STRING) .description("보호소 이름"), - fieldWithPath("findApplyingVolunteerResponses[].status").type( + fieldWithPath("findApplyingVolunteerResponses[].applicantStatus").type( JsonFieldType.STRING) .description("승인 상태"), - fieldWithPath("findApplyingVolunteerResponses[].isWritedReview").type( + fieldWithPath("findApplyingVolunteerResponses[].applicantIsWritedReview").type( JsonFieldType.BOOLEAN) .description("후기 작성 가능 여부"), - fieldWithPath("findApplyingVolunteerResponses[].volunteerDate").type( + fieldWithPath("findApplyingVolunteerResponses[].recruitmentStartTime").type( JsonFieldType.STRING) .description("봉사 날짜") ) diff --git a/src/test/java/com/clova/anifriends/domain/applicant/repository/ApplicantRepositoryTest.java b/src/test/java/com/clova/anifriends/domain/applicant/repository/ApplicantRepositoryTest.java index 79a7e3aa9..d72864ea6 100644 --- a/src/test/java/com/clova/anifriends/domain/applicant/repository/ApplicantRepositoryTest.java +++ b/src/test/java/com/clova/anifriends/domain/applicant/repository/ApplicantRepositoryTest.java @@ -144,12 +144,12 @@ void findApplyingVolunteers() { applyingVolunteers); // then - assertThat(expected.findApplyingVolunteerResponses().get(0).isWritedReview()).isEqualTo( - true); - assertThat(expected.findApplyingVolunteerResponses().get(1).isWritedReview()).isEqualTo( - false); - assertThat(expected.findApplyingVolunteerResponses().get(2).isWritedReview()).isEqualTo( - false); + assertThat(expected.findApplyingVolunteerResponses().get(0) + .applicantIsWritedReview()).isTrue(); + assertThat(expected.findApplyingVolunteerResponses().get(1) + .applicantIsWritedReview()).isFalse(); + assertThat(expected.findApplyingVolunteerResponses().get(2) + .applicantIsWritedReview()).isFalse(); } } } diff --git a/src/test/java/com/clova/anifriends/domain/applicant/service/ApplicantServiceTest.java b/src/test/java/com/clova/anifriends/domain/applicant/service/ApplicantServiceTest.java index 5fe338c3a..faadb1a33 100644 --- a/src/test/java/com/clova/anifriends/domain/applicant/service/ApplicantServiceTest.java +++ b/src/test/java/com/clova/anifriends/domain/applicant/service/ApplicantServiceTest.java @@ -193,13 +193,13 @@ void findApplyingVolunteers1() { // then assertThat(foundApplyingVolunteers.findApplyingVolunteerResponses().get(0) - .isWritedReview()).isEqualTo( + .applicantIsWritedReview()).isEqualTo( findApplyingVolunteersResponse.findApplyingVolunteerResponses().get(0) - .isWritedReview()); + .applicantIsWritedReview()); assertThat(foundApplyingVolunteers.findApplyingVolunteerResponses().get(1) - .isWritedReview()).isEqualTo( + .applicantIsWritedReview()).isEqualTo( findApplyingVolunteersResponse.findApplyingVolunteerResponses().get(1) - .isWritedReview()); + .applicantIsWritedReview()); } @Test @@ -231,13 +231,13 @@ void findApplyingVolunteers2() { // then assertThat(foundApplyingVolunteers.findApplyingVolunteerResponses().get(0) - .isWritedReview()).isEqualTo( + .applicantIsWritedReview()).isEqualTo( findApplyingVolunteersResponse.findApplyingVolunteerResponses().get(0) - .isWritedReview()); + .applicantIsWritedReview()); assertThat(foundApplyingVolunteers.findApplyingVolunteerResponses().get(1) - .isWritedReview()).isEqualTo( + .applicantIsWritedReview()).isEqualTo( findApplyingVolunteersResponse.findApplyingVolunteerResponses().get(1) - .isWritedReview()); + .applicantIsWritedReview()); } } }