diff --git a/src/main/java/org/festimate/team/api/facade/ParticipantFacade.java b/src/main/java/org/festimate/team/api/facade/ParticipantFacade.java index 1a8bd5d..24b53b2 100644 --- a/src/main/java/org/festimate/team/api/facade/ParticipantFacade.java +++ b/src/main/java/org/festimate/team/api/facade/ParticipantFacade.java @@ -42,6 +42,7 @@ public EntryResponse createParticipant(Long userId, Long festivalId, ProfileRequ throw new FestimateException(ResponseError.PARTICIPANT_ALREADY_EXISTS); } Participant participant = participantService.createParticipant(user, festival, request); + pointService.rechargePoint(participant, 10); matchingService.matchPendingParticipants(participant); return EntryResponse.of(participant); diff --git a/src/test/java/org/festimate/team/api/facade/ParticipantFacadeTest.java b/src/test/java/org/festimate/team/api/facade/ParticipantFacadeTest.java index fc5427b..0fb08ce 100644 --- a/src/test/java/org/festimate/team/api/facade/ParticipantFacadeTest.java +++ b/src/test/java/org/festimate/team/api/facade/ParticipantFacadeTest.java @@ -81,6 +81,24 @@ void createParticipant_success() { verify(matchingService).matchPendingParticipants(participant); } + @Test + @DisplayName("참가자 생성 시 10포인트가 충전된다") + void createParticipant_success_point() { + when(userService.getUserByIdOrThrow(1L)).thenReturn(user); + when(festivalService.getFestivalByIdOrThrow(1L)).thenReturn(festival); + when(participantService.getParticipant(user, festival)).thenReturn(null); + when(participantService.createParticipant(any(), any(), any())).thenReturn(participant); + + var response = participantFacade.createParticipant(1L, 1L, null); + + // then + assertThat(response.participantId()).isNotNull(); + // 포인트 충전 메서드 호출 여부 검증 + verify(pointService).rechargePoint(participant, 10); + // 매칭 메서드 호출 여부 검증 + verify(matchingService).matchPendingParticipants(participant); + } + @Test @DisplayName("내 프로필 조회 성공") void getParticipantProfile_success() {