Skip to content

Commit 2e2862b

Browse files
committed
test(InterestCenterQueryService): 센터 아이디로 봉사자 아이디 목록 조회 테스트 추가
1 parent 54993ff commit 2e2862b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/test/java/com/somemore/interestcenter/service/InterestCenterQueryServiceTest.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,47 @@ void getInterestCenters_ReturnsEmptyList_WhenNoInterestCenters() {
8686
assertThat(result).isEmpty();
8787
}
8888

89+
@DisplayName("센터 ID로 봉사자 ID 목록을 조회할 수 있다.")
90+
@Test
91+
void getVolunteerIdsByCenterId() {
92+
// given
93+
UUID centerId = UUID.randomUUID();
94+
UUID volunteerId1 = UUID.randomUUID();
95+
UUID volunteerId2 = UUID.randomUUID();
96+
UUID volunteerId3 = UUID.randomUUID();
97+
98+
InterestCenter interestCenter1 = createInterestCenter(volunteerId1, centerId);
99+
InterestCenter interestCenter2 = createInterestCenter(volunteerId2, centerId);
100+
InterestCenter interestCenter3 = createInterestCenter(volunteerId3, centerId);
101+
interestCenterJpaRepository.saveAll(List.of(interestCenter1, interestCenter2, interestCenter3));
102+
103+
// when
104+
List<UUID> result = interestCenterQueryService.getVolunteerIdsByCenterId(centerId);
105+
106+
// then
107+
assertThat(result)
108+
.hasSize(3)
109+
.containsExactlyInAnyOrder(volunteerId1, volunteerId2, volunteerId3);
110+
}
111+
112+
@DisplayName("센터 ID에 등록된 봉사자가 없을 경우 빈 리스트를 반환한다.")
113+
@Test
114+
void getVolunteerIdsByCenterId_ReturnsEmptyList_WhenNoVolunteers() {
115+
// given
116+
UUID centerId = UUID.randomUUID();
117+
118+
Center center = createCenter();
119+
centerJpaRepository.save(center);
120+
121+
// when
122+
List<UUID> result = interestCenterQueryService.getVolunteerIdsByCenterId(centerId);
123+
124+
// then
125+
assertThat(result).isEmpty();
126+
}
127+
128+
129+
89130

90131
private Center createCenter() {
91132
return Center.create(

0 commit comments

Comments
 (0)