Skip to content

Commit

Permalink
[Fix] : 동일 회원 스터디 참여 요청 예외 처리 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
elyudwo committed Jan 23, 2024
1 parent 87a643a commit 0146646
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public FindApplyResponse findApply(FindApplyRequest request, final int page, fin
}

private void validateSameRequest(UserEntity user, StudyEntity study) {
applyRepository.findByUserIdAndStudyId(user.getId(), study.getId()).orElseThrow(SameUserRequestException::new);
if(applyRepository.findByUserIdAndStudyId(user.getId(), study.getId()).isPresent()) {
throw new SameUserRequestException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class ApplyServiceTest {

when(userRepository.findById(anyLong())).thenReturn(Optional.ofNullable(user));
when(studyRepository.findById(anyLong())).thenReturn(Optional.ofNullable(study));
when(applyRepository.findByUserIdAndStudyId(user.getId(), study.getId())).thenReturn(Optional.ofNullable(ApplyEntity.builder().build()));
when(applyRepository.save(any())).thenReturn(ApplyEntity.builder()
.userId(user.getId())
.study(study.getId())
Expand Down

0 comments on commit 0146646

Please sign in to comment.