From b2143f4dacefabdbccd9711da8a8717feb949bb0 Mon Sep 17 00:00:00 2001 From: dailyworker Date: Fri, 19 Feb 2021 12:01:17 +0900 Subject: [PATCH] =?UTF-8?q?test=20:=20UserPlayground=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20-=201.=20UserPlayg?= =?UTF-8?q?ound=EA=B0=80=20=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EB=90=98=EC=97=88=EB=8A=94=EC=A7=80=20(id=20>=200)=20?= =?UTF-8?q?-=202.=20Playground=EC=9D=98=20UserPlaygrounds=EC=9D=98=20?= =?UTF-8?q?=EC=B2=AB=EB=B2=88=EC=A7=B8=20=EC=9D=B8=EB=8D=B1=EC=8A=A4?= =?UTF-8?q?=EC=99=80=20=EC=82=BD=EC=9E=85=ED=95=A0=20UserPlayground?= =?UTF-8?q?=EC=99=80=20=EC=9D=BC=EC=B9=98=ED=95=98=EB=8A=94=EC=A7=80=20-?= =?UTF-8?q?=203.=20Repository=EC=97=90=EC=84=9C=20=EA=B0=80=EC=A0=B8?= =?UTF-8?q?=EC=98=A8=20User=EC=99=80=20Playground=EC=9D=98=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=EA=B0=80=20=EC=9D=BC=EC=B9=98=ED=95=98=EB=8A=94?= =?UTF-8?q?=EC=A7=80=20-=204.=20=EC=B4=88=EA=B8=B0=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EB=90=9C=20Playground=EC=9D=98=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EC=97=90=20=EC=82=BD=EC=9E=85=EB=90=9C=20Use?= =?UTF-8?q?r=EB=A5=BC=20=EB=A6=AC=EB=8D=94=EB=A1=9C=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=ED=95=98=EB=8A=94=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pg/programmerground/domain/PlaygroundTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Backend/src/test/java/com/pg/programmerground/domain/PlaygroundTest.java b/Backend/src/test/java/com/pg/programmerground/domain/PlaygroundTest.java index 2d5de32..d356058 100644 --- a/Backend/src/test/java/com/pg/programmerground/domain/PlaygroundTest.java +++ b/Backend/src/test/java/com/pg/programmerground/domain/PlaygroundTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.pg.programmerground.domain.github.Oauth2AuthorizedClient; import com.pg.programmerground.exception.UserNotFoundException; @@ -41,6 +42,7 @@ class PlaygroundTest { // } @Test + @DisplayName("사용자와 Playground 정보가 UserPlaygound 테이블에 제대로 매핑되는가") public void create_playground() throws Exception { //given Oauth2AuthorizedClient oauth2AuthorizedClient = Oauth2AuthorizedClient.builder().id(123L).build(); @@ -55,17 +57,21 @@ public void create_playground() throws Exception { oAuthUserRepository.save(user); - OAuthUser oAuthUser = oAuthUserRepository.findById(1L).orElseThrow(UserNotFoundException::new); + OAuthUser getUser = oAuthUserRepository.findById(1L).orElseThrow(UserNotFoundException::new); //when - OAuthUserPlayground userPlayground = OAuthUserPlayground.createOAuthUserPlayground(oAuthUser); + OAuthUserPlayground userPlayground = OAuthUserPlayground.createOAuthUserPlayground(getUser); Playground playground = Playground.createPlayground(userPlayground); Playground getPlayground = playgroundRepository.save(playground); - + //then assertAll( - () -> assertEquals(oAuthUser.getUserName(), getPlayground.getLeader().getUserName()) + () -> assertTrue(userPlayground.getId() > 0), + () -> assertEquals(getPlayground.getUserPlaygrounds().get(0), userPlayground), + () -> assertEquals(getUser, userPlayground.getUser()), + () -> assertEquals(getPlayground, userPlayground.getPlayground()), + () -> assertEquals(getPlayground.getLeader().getId(), getUser.getId()) ); } } \ No newline at end of file