-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import com.backend.blooming.authentication.infrastructure.oauth.OAuthType; | ||
import com.backend.blooming.themecolor.domain.ThemeColor; | ||
import org.assertj.core.api.*; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Test; | ||
|
@@ -13,6 +14,26 @@ | |
@SuppressWarnings("NonAsciiCharacters") | ||
class UserTest extends UserTestFixture { | ||
|
||
@Test | ||
void 사용자_생성시_이름_색상_상태메시지를_설정하지_않을시_기본값으로_설정한다() { | ||
// when | ||
final User actual = User.builder() | ||
.oAuthId("12345") | ||
.oAuthType(OAuthType.KAKAO) | ||
.email(new Email("[email protected]")) | ||
.build(); | ||
|
||
// then | ||
SoftAssertions.assertSoftly(softAssertions -> { | ||
softAssertions.assertThat(actual.getOAuthId()).isEqualTo("12345"); | ||
softAssertions.assertThat(actual.getOAuthType()).isEqualTo(OAuthType.KAKAO); | ||
softAssertions.assertThat(actual.getEmail()).isEqualTo("[email protected]"); | ||
softAssertions.assertThat(actual.getName()).isEqualTo(""); | ||
softAssertions.assertThat(actual.getColor()).isEqualTo(ThemeColor.INDIGO); | ||
softAssertions.assertThat(actual.getStatusMessage()).isEqualTo(""); | ||
}); | ||
} | ||
|
||
@Test | ||
void 사용자를_삭제한다() { | ||
// when | ||
|
@@ -80,7 +101,7 @@ class UserTest extends UserTestFixture { | |
} | ||
|
||
@Test | ||
void 테마_색상의_이름_조회시_테마_색상을_선택했다면_해당_색상의_이름을_반환한다() { | ||
void 이메일_조회시_이메일_값을_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.oAuthId("12345") | ||
|
@@ -91,31 +112,32 @@ class UserTest extends UserTestFixture { | |
.build(); | ||
|
||
// when | ||
final String actual = user.getColorName(); | ||
final String actual = user.getEmail(); | ||
|
||
// then | ||
assertThat(actual).isEqualTo(ThemeColor.BEIGE.name()); | ||
assertThat(actual).isEqualTo("[email protected]"); | ||
} | ||
|
||
@Test | ||
void 테마_색상의_이름_조회시_테마_색상을_선택하기_전이라면_null을_반환한다() { | ||
void 테마_색상의_이름_조회시_해당_색상의_이름을_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.oAuthId("12345") | ||
.oAuthType(OAuthType.KAKAO) | ||
.name("사용자") | ||
.email(new Email("[email protected]")) | ||
.color(ThemeColor.BEIGE) | ||
.build(); | ||
|
||
// when | ||
final String actual = user.getColorName(); | ||
|
||
// then | ||
assertThat(actual).isNull(); | ||
assertThat(actual).isEqualTo(ThemeColor.BEIGE.name()); | ||
} | ||
|
||
@Test | ||
void 테마_색상의_코드_조회시_테마_색상을_선택했다면_해당_색상의_코드를_반환한다() { | ||
void 테마_색상의_코드_조회시_해당_색상의_코드를_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.oAuthId("12345") | ||
|
@@ -131,21 +153,4 @@ class UserTest extends UserTestFixture { | |
// then | ||
assertThat(actual).isEqualTo(ThemeColor.BEIGE.getCode()); | ||
} | ||
|
||
@Test | ||
void 테마_색상의_코드_조회시_테마_색상을_선택하기_전이라면_null을_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.oAuthId("12345") | ||
.oAuthType(OAuthType.KAKAO) | ||
.name("사용자") | ||
.email(new Email("[email protected]")) | ||
.build(); | ||
|
||
// when | ||
final String actual = user.getColorCode(); | ||
|
||
// then | ||
assertThat(actual).isNull(); | ||
} | ||
} |