From 96291baf673f14c099a579a677cee09d220eb613 Mon Sep 17 00:00:00 2001 From: jjuny7712 Date: Sat, 16 Sep 2023 22:09:34 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=9C=A0=ED=9A=A8=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EC=9D=80=20loginMemberId=EA=B0=80=20=EC=A3=BC?= =?UTF-8?q?=EC=96=B4=EC=A1=8C=EB=8B=A4=EB=A9=B4=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=20=EC=8A=A4=ED=81=AC=EB=9E=A9=EC=97=90=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=EB=A5=BC=20=EB=B0=9C=EC=83=9D=ED=95=A9=EB=8B=88?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/post/service/PostServiceTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/ssafy/ssafsound/domain/post/service/PostServiceTest.java b/src/test/java/com/ssafy/ssafsound/domain/post/service/PostServiceTest.java index 0897d8f4..ee0bbe45 100644 --- a/src/test/java/com/ssafy/ssafsound/domain/post/service/PostServiceTest.java +++ b/src/test/java/com/ssafy/ssafsound/domain/post/service/PostServiceTest.java @@ -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