From f0d4e88bf03c4dc00ec59c7885b07275bf1bc3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=9A=B0=EC=9E=AC?= Date: Sun, 3 Oct 2021 23:58:18 +0900 Subject: [PATCH] =?UTF-8?q?[#54]=20test:=20FollowRepository=20=EC=9D=B8?= =?UTF-8?q?=EC=8A=A4=ED=84=B4=EC=8A=A4=20findById()=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../follow/domain/FollowRepositoryTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/test/java/com/study/realworld/domain/follow/domain/FollowRepositoryTest.java b/src/test/java/com/study/realworld/domain/follow/domain/FollowRepositoryTest.java index 24a63c53..b4f53ce4 100644 --- a/src/test/java/com/study/realworld/domain/follow/domain/FollowRepositoryTest.java +++ b/src/test/java/com/study/realworld/domain/follow/domain/FollowRepositoryTest.java @@ -41,4 +41,26 @@ void save_test() { ); } + @DisplayName("FollowRepository 인스턴스 findById() 테스트") + @Test + void findById_test() { + final User following = userBuilder(new Email(EMAIL), new Name(USERNAME), new Password(PASSWORD), new Bio(BIO), new Image(IMAGE)); + final User follower = userBuilder(new Email("Email2@email.com"), new Name("differentUserName"), new Password("Password2"), new Bio("Bio2"), new Image("Image2")); + final Follow follow = followBuilder(following, follower); + + testEntityManager.persist(following); + testEntityManager.persist(follower); + testEntityManager.persist(follow); + + final Follow findFollow = followRepository.findById(1L).get(); + + assertAll( + () -> assertThat(findFollow).isNotNull(), + () -> assertThat(findFollow).isExactlyInstanceOf(Follow.class), + () -> assertThat(findFollow).isEqualTo(follow) + ); + } + + + }