Skip to content

Commit 5d352bf

Browse files
committed
test(volunteer-apply): 누락된 테스트 추가
1 parent bb0a34c commit 5d352bf

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/test/java/com/somemore/domains/volunteerapply/service/VolunteerApplyQueryServiceTest.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.somemore.domains.volunteerapply.service;
22

3+
import static com.somemore.domains.volunteerapply.domain.ApplyStatus.APPROVED;
4+
import static com.somemore.domains.volunteerapply.domain.ApplyStatus.REJECTED;
5+
import static com.somemore.domains.volunteerapply.domain.ApplyStatus.WAITING;
6+
import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_VOLUNTEER_APPLY;
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
9+
310
import com.somemore.domains.volunteerapply.domain.ApplyStatus;
411
import com.somemore.domains.volunteerapply.domain.VolunteerApply;
512
import com.somemore.domains.volunteerapply.dto.condition.VolunteerApplySearchCondition;
613
import com.somemore.domains.volunteerapply.dto.response.VolunteerApplyResponseDto;
714
import com.somemore.domains.volunteerapply.dto.response.VolunteerApplySummaryResponseDto;
815
import com.somemore.domains.volunteerapply.repository.VolunteerApplyRepository;
16+
import com.somemore.global.exception.NoSuchElementException;
917
import com.somemore.support.IntegrationTestSupport;
18+
import java.util.List;
19+
import java.util.UUID;
1020
import org.junit.jupiter.api.DisplayName;
1121
import org.junit.jupiter.api.Test;
1222
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,12 +25,6 @@
1525
import org.springframework.data.domain.Pageable;
1626
import org.springframework.transaction.annotation.Transactional;
1727

18-
import java.util.List;
19-
import java.util.UUID;
20-
21-
import static com.somemore.domains.volunteerapply.domain.ApplyStatus.*;
22-
import static org.assertj.core.api.Assertions.assertThat;
23-
2428
@Transactional
2529
class VolunteerApplyQueryServiceTest extends IntegrationTestSupport {
2630

@@ -193,6 +197,22 @@ void getAllByIds() {
193197
.containsExactlyInAnyOrderElementsOf(ids);
194198
}
195199

200+
@DisplayName("존재하지 않는 봉사 지원을 조회할 경우 에러가 발생한다.")
201+
@Test
202+
void getByRecruitIdAndVolunteerIdWhenNotExist() {
203+
// given
204+
Long wrongBoardId = 999L;
205+
UUID wrongVolunteerId = UUID.randomUUID();
206+
207+
// when
208+
// then
209+
assertThatThrownBy(
210+
() -> volunteerApplyQueryService.getByRecruitIdAndVolunteerId(wrongBoardId,
211+
wrongVolunteerId)
212+
).isInstanceOf(NoSuchElementException.class)
213+
.hasMessage(NOT_EXISTS_VOLUNTEER_APPLY.getMessage());
214+
}
215+
196216
private VolunteerApply createApply(UUID volunteerId, Long recruitId) {
197217
return createApply(volunteerId, recruitId, WAITING);
198218
}

0 commit comments

Comments
 (0)