Skip to content

Commit

Permalink
test: 별점 서비스 테스트 db lock 쿼리 메소드 반영 #111
Browse files Browse the repository at this point in the history
  • Loading branch information
FaberJoo committed Nov 16, 2023
1 parent a835f3b commit 47197fc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void createScore() {
.willReturn(Optional.empty());
given(memberRepository.findById(memberId))
.willReturn(Optional.ofNullable(member));
given(animeRepository.findById(animeId))
given(animeRepository.findByIdForUpdate(animeId))
.willReturn(Optional.ofNullable(anime));

// when
Expand Down Expand Up @@ -173,6 +173,8 @@ void updateScore() {

given(starRatingRepository.findByMemberIdAndAnimeId(memberId, animeId))
.willReturn(Optional.ofNullable(starRating));
given(animeRepository.findByIdForUpdate(animeId))
.willReturn(Optional.ofNullable(anime));

// when
boolean result = starRatingService.updateScore(memberId, animeId, 5);
Expand All @@ -194,6 +196,8 @@ void updateScoreIfNotExist() {

given(starRatingRepository.findByMemberIdAndAnimeId(memberId, animeId))
.willReturn(Optional.ofNullable(starRating));
given(animeRepository.findByIdForUpdate(animeId))
.willReturn(Optional.ofNullable(anime));

// when
boolean result = starRatingService.updateScore(memberId, animeId, score);
Expand Down

0 comments on commit 47197fc

Please sign in to comment.