Skip to content

Commit

Permalink
test: 유효하지 않은 loginMemberId가 주어졌다면 게시글 스크랩에 예외를 발생합니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjuny0310 committed Sep 16, 2023
1 parent 6496ae9 commit 7d58db6
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,18 @@ void Given_PostIdAndLoginMemberId_When_DeleteScrapPost_Then_Success() {
@DisplayName("유효하지 않은 loginMemberId가 주어졌다면 게시글 스크랩에 예외를 발생합니다.")
void Given_InvalidLoginMemberId_When_scrapPost_Then_Success() {
// given
Long memberId = -101L;
Post post = POST_FIXTURE1;

// when
given(memberRepository.findById(memberId)).willReturn(Optional.empty());

// then
// when, then
MemberException exception = assertThrows(MemberException.class,
() -> postService.scrapPost(post.getId(), memberId));
assertEquals(MemberErrorInfo.MEMBER_NOT_FOUND_BY_ID, exception.getInfo());

// verify

verify(memberRepository, times(1)).findById(memberId);
}

@Test
Expand Down

0 comments on commit 7d58db6

Please sign in to comment.