test(user.domain) : 회원 닉네임 변경 테스트 추가
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.banjjoknim.cleanarchitecture.user.domain
|
||||
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertDoesNotThrow
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
|
||||
class NicknameTest {
|
||||
|
||||
@DisplayName("닉네임 생성 테스트")
|
||||
@Nested
|
||||
inner class ChangeNicknameTestCases {
|
||||
@Test
|
||||
fun `10글자 이내이면 닉네임을 생성할 수 있다`() {
|
||||
assertDoesNotThrow { Nickname("banjjoknim") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `10글자가 넘으면 닉네임을 생성할 경우 예외가 발생한다`() {
|
||||
assertThrows<IllegalArgumentException> { Nickname("i'm banjjoknim") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.banjjoknim.cleanarchitecture.user.domain
|
||||
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class UserTest {
|
||||
|
||||
@DisplayName("회원 이름 변경 테스트 케이스")
|
||||
@Nested
|
||||
inner class ChangeNicknameTestCases {
|
||||
@Test
|
||||
fun `회원 닉네임을 변경한다`() {
|
||||
// given
|
||||
val user = User(nickname = Nickname("banjjoknim"))
|
||||
|
||||
// when
|
||||
user.changeNickname("colt")
|
||||
|
||||
// then
|
||||
assertThat(user.nickname).isEqualTo(Nickname("colt"))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user