Skip to content

Commit

Permalink
feat: 탈퇴 시 닉네임을 랜덤 UUID로 변경하는 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ503 committed Oct 11, 2023
1 parent 7982da8 commit 8a98347
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import lombok.ToString;

import java.util.List;
import java.util.UUID;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down Expand Up @@ -87,6 +88,7 @@ public void updateProfileImage(final ProfileImage profileImage) {

public void withdrawal() {
this.deleted = DELETED_STATUS;
this.name = UUID.randomUUID().toString();
}

public void updateReliability(final List<Review> reviews) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ void setUp() {
authenticationService.withdrawal(지원하는_소셜_로그인_타입, 유효한_액세스_토큰, 유효한_리프레시_토큰);

// then
assertThat(사용자.isDeleted()).isTrue();
SoftAssertions.assertSoftly(softAssertions -> {
softAssertions.assertThat(사용자.isDeleted()).isTrue();
softAssertions.assertThat(사용자.getName()).isNotEqualTo(사용자_이름);
});
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class AuthenticationServiceFixture {

protected String 디바이스_토큰 = "deviceToken";

protected String 사용자_이름;
protected User 사용자;
protected User 탈퇴한_사용자;

Expand Down Expand Up @@ -68,6 +69,7 @@ void fixtureSetUp() {
.reliability(new Reliability(0.0d))
.oauthId("12345")
.build();
사용자_이름 = 사용자.getName();

탈퇴한_사용자 = User.builder()
.name("kakao12346")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class UserTest extends UserFixture {

// when
final User user = User.builder()
.name("kakao12345")
.profileImage(new ProfileImage("uplad.png", "store.png"))
.reliability(nullReliability)
.oauthId("12345")
.build();
.name("kakao12345")
.profileImage(new ProfileImage("uplad.png", "store.png"))
.reliability(nullReliability)
.oauthId("12345")
.build();

// then
assertThat(user.getReliability()).isEqualTo(expect);
Expand Down Expand Up @@ -93,8 +93,9 @@ class UserTest extends UserFixture {
@Test
void 회원_탈퇴한다() {
// given
final String userName = "kakao12345";
final User user = User.builder()
.name("kakao12345")
.name(userName)
.profileImage(new ProfileImage("upload.png", "store.png"))
.reliability(new Reliability(5.0d))
.oauthId("12345")
Expand All @@ -104,7 +105,10 @@ class UserTest extends UserFixture {
user.withdrawal();

// then
assertThat(user.isDeleted()).isTrue();
SoftAssertions.assertSoftly(softAssertions -> {
softAssertions.assertThat(user.isDeleted()).isTrue();
softAssertions.assertThat(user.getName()).isNotEqualTo(userName);
});
}

@Test
Expand Down

0 comments on commit 8a98347

Please sign in to comment.