From e958773a1e4864b37a27411c3bb535778194cc84 Mon Sep 17 00:00:00 2001 From: cabbage16 Date: Wed, 27 Nov 2024 23:09:52 +0900 Subject: [PATCH] =?UTF-8?q?fix(#30):=20Google=20OAuth=EB=A5=BC=20=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=ED=95=9C=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20-=20Build?= =?UTF-8?q?er=EC=97=90=EC=84=9C=20password=EB=A5=BC=20=EC=A0=95=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=95=84=EB=8F=84=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20password=EC=97=90=20null=EC=9D=B4=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EA=B0=80=EB=A9=B4=EC=84=9C=20PasswordUtil.en?= =?UTF-8?q?code(null)=20=EC=9D=B4=20=ED=98=B8=EC=B6=9C=EB=90=98=EB=8D=98?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=EB=A5=BC=20=ED=95=B4=EA=B2=B0=ED=96=88?= =?UTF-8?q?=EC=96=B4=EC=9A=94.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sinabro/domain/user/domain/User.java | 2 +- .../sinabro/shared/fixture/UserFixture.java | 12 ++++++++++-- .../sinabro/shared/util/ControllerTest.java | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/bamdoliro/sinabro/domain/user/domain/User.java b/src/main/java/com/bamdoliro/sinabro/domain/user/domain/User.java index 9cd9b1b..6792885 100644 --- a/src/main/java/com/bamdoliro/sinabro/domain/user/domain/User.java +++ b/src/main/java/com/bamdoliro/sinabro/domain/user/domain/User.java @@ -40,7 +40,7 @@ public class User extends BaseTimeEntity { public User(String email, String name, String password, Authority authority) { this.email = email; this.name = name; - this.password = new Password(PasswordUtil.encode(password)); + this.password = password == null ? null : new Password(PasswordUtil.encode(password)); this.authority = authority; } } diff --git a/src/test/java/com/bamdoliro/sinabro/shared/fixture/UserFixture.java b/src/test/java/com/bamdoliro/sinabro/shared/fixture/UserFixture.java index 73cfd4c..8cee71f 100644 --- a/src/test/java/com/bamdoliro/sinabro/shared/fixture/UserFixture.java +++ b/src/test/java/com/bamdoliro/sinabro/shared/fixture/UserFixture.java @@ -6,10 +6,18 @@ public class UserFixture { public static User createUser() { - return new User("bamdoliro@gmail.com", "김밤돌", Authority.USER); + return User.builder() + .email("bamdoliro@gmail.com") + .name("김밤돌") + .authority(Authority.USER) + .build(); } public static User createAdmin() { - return new User("bamdoliro@gmail.com", "어드민", Authority.ADMIN); + return User.builder() + .email("bamdoliro@gmail.com") + .name("어드민") + .authority(Authority.ADMIN) + .build(); } } diff --git a/src/test/java/com/bamdoliro/sinabro/shared/util/ControllerTest.java b/src/test/java/com/bamdoliro/sinabro/shared/util/ControllerTest.java index 811ad71..0d37d0b 100644 --- a/src/test/java/com/bamdoliro/sinabro/shared/util/ControllerTest.java +++ b/src/test/java/com/bamdoliro/sinabro/shared/util/ControllerTest.java @@ -20,6 +20,9 @@ import com.bamdoliro.sinabro.application.notification.SendNotificationToAllUserUseCase; import com.bamdoliro.sinabro.application.notification.SendNotificationUseCase; import com.bamdoliro.sinabro.application.question.*; +import com.bamdoliro.sinabro.application.user.SendVerificationUseCase; +import com.bamdoliro.sinabro.application.user.SignUpUseCase; +import com.bamdoliro.sinabro.application.user.VerifyUseCase; import com.bamdoliro.sinabro.domain.auth.service.TokenService; import com.bamdoliro.sinabro.presentation.answer.AnswerController; import com.bamdoliro.sinabro.presentation.auth.AuthController; @@ -71,6 +74,9 @@ public abstract class ControllerTest { // UseCase // Auth + @MockBean + protected LogInUseCase logInUseCase; + @MockBean protected GoogleAuthLinkUseCase googleAuthLinkUseCase; @@ -86,6 +92,16 @@ public abstract class ControllerTest { @MockBean protected LogOutUseCase logOutUseCase; + // User + @MockBean + protected SignUpUseCase signUpUseCase; + + @MockBean + protected SendVerificationUseCase sendVerificationUseCase; + + @MockBean + protected VerifyUseCase verifyUseCase; + // Diary @MockBean protected CreateDiaryUseCase createDiaryUseCase;