Skip to content

Commit

Permalink
fix(#30): Google OAuth를 이용한 회원가입 시 에러 해결
Browse files Browse the repository at this point in the history
- Builder에서 password를 정하지 않아도 자동으로 password에 null이 들어가면서 PasswordUtil.encode(null) 이 호출되던 문제를 해결했어요.
  • Loading branch information
cabbage16 committed Nov 27, 2024
1 parent 8170833 commit e958773
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
public class UserFixture {

public static User createUser() {
return new User("[email protected]", "김밤돌", Authority.USER);
return User.builder()
.email("[email protected]")
.name("김밤돌")
.authority(Authority.USER)
.build();
}

public static User createAdmin() {
return new User("[email protected]", "어드민", Authority.ADMIN);
return User.builder()
.email("[email protected]")
.name("어드민")
.authority(Authority.ADMIN)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,6 +74,9 @@ public abstract class ControllerTest {
// UseCase

// Auth
@MockBean
protected LogInUseCase logInUseCase;

@MockBean
protected GoogleAuthLinkUseCase googleAuthLinkUseCase;

Expand All @@ -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;
Expand Down

0 comments on commit e958773

Please sign in to comment.