Skip to content

Commit

Permalink
refactor: 봉사자가 신청한 봉사 리스트 조회(봉사자)를 명세에 맞게 수정한다. (#161)
Browse files Browse the repository at this point in the history
* refactor: 응답 필드명을 수정한다.

* refactor: FindApplyingVolunteerResponse에 shelterId를 추가한다.

* refactor: isEqualTo(false)를 isFalse()로 변경한다.
  • Loading branch information
bjo6300 authored Nov 8, 2023
1 parent 3087a85 commit 941d999
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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("봉사 날짜")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
}
}

0 comments on commit 941d999

Please sign in to comment.