Skip to content

Commit

Permalink
fix: Member 의 profileImage 가 null 인 경우의 null check 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
BGuga committed Aug 15, 2023
1 parent d44b870 commit a7e25bf
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions backend/src/main/java/com/festago/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class Member extends BaseTimeEntity {

private static final String DEFAULT_IMAGE_URL = "https://festa-go.site/images/default-profile.png";

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down Expand Up @@ -52,24 +52,23 @@ public Member(String socialId, SocialType socialType, String nickname, String pr
}

public Member(Long id, String socialId, SocialType socialType, String nickname, String profileImage) {
validate(socialId, socialType, nickname, profileImage);
validate(socialId, socialType, nickname);
this.id = id;
this.socialId = socialId;
this.socialType = socialType;
this.nickname = nickname;
this.profileImage = (profileImage != null) ? profileImage : DEFAULT_IMAGE_URL;
}

private void validate(String socialId, SocialType socialType, String nickname, String profileImage) {
checkNotNull(socialId, socialType, nickname, profileImage);
private void validate(String socialId, SocialType socialType, String nickname) {
checkNotNull(socialId, socialType, nickname);
checkLength(socialId, nickname, profileImage);
}

private void checkNotNull(String socialId, SocialType socialType, String nickname, String profileImage) {
private void checkNotNull(String socialId, SocialType socialType, String nickname) {
if (Objects.isNull(socialId) ||
Objects.isNull(socialType) ||
Objects.isNull(nickname) ||
Objects.isNull(profileImage)) {
Objects.isNull(nickname)) {
throw new IllegalArgumentException("Member 는 허용되지 않은 null 값으로 생성할 수 없습니다.");
}
}
Expand Down

0 comments on commit a7e25bf

Please sign in to comment.