From 70d5574873ad21b71a8decfad53d86eabc7fb60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Sat, 28 Jan 2023 13:00:00 +0900 Subject: [PATCH 1/8] =?UTF-8?q?MoneyTest=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/malibin/study/domain/lotto/result/MoneyTest.kt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt new file mode 100644 index 0000000..9bac3c3 --- /dev/null +++ b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt @@ -0,0 +1,4 @@ +package com.malibin.study.domain.lotto.result + +internal class MoneyTest { +} From 3174314882aa3e76602025ce10d0c8680cbd0bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Sat, 28 Jan 2023 13:42:54 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=EB=8F=88=EC=9D=98=20=EC=95=A1=EC=88=98?= =?UTF-8?q?=EA=B0=80=20=EC=9D=8C=EC=88=98=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../study/domain/lotto/result/MoneyTest.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt index 9bac3c3..b1cf8f6 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt @@ -1,4 +1,20 @@ package com.malibin.study.domain.lotto.result +import com.google.common.truth.Truth +import org.junit.jupiter.api.Test + internal class MoneyTest { + @Test + fun `돈의 액수는 음수가 될 수 없다`() { + // given + val money = Money(-1) + + // when + val exception = kotlin.runCatching { + money + }.exceptionOrNull() + + // then + Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) + } } From 074c5a980a7adbc2c711c57bd68ec5298ee3100c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Sun, 29 Jan 2023 11:30:25 +0900 Subject: [PATCH 3/8] =?UTF-8?q?Money=EC=9D=98=20plus=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../malibin/study/domain/lotto/result/MoneyTest.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt index b1cf8f6..1222d49 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt @@ -17,4 +17,18 @@ internal class MoneyTest { // then Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) } + + @Test + fun `돈을 더할 수 있다`() { + // given + val money1 = Money(1000) + val money2 = Money(2000) + val plusResult = money1 + money2 + + // when + val actualPlusResult = money1.plus(money2) + + // then + Truth.assertThat(actualPlusResult).isEqualTo(plusResult) + } } From 67d175e0ea9a9e17040d4e603b8fda4d1eabf02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Mon, 30 Jan 2023 23:40:35 +0900 Subject: [PATCH 4/8] =?UTF-8?q?Money=EC=9D=98=20minus=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../malibin/study/domain/lotto/result/MoneyTest.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt index 1222d49..f18a481 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/result/MoneyTest.kt @@ -31,4 +31,18 @@ internal class MoneyTest { // then Truth.assertThat(actualPlusResult).isEqualTo(plusResult) } + + @Test + fun `돈을 뺄 수 있다`() { + // given + val money1 = Money(1000) + val money2 = Money(2000) + val minusResult = money2 - money1 + + // when + val actualMinusResult = money2.minus(money1) + + // then + Truth.assertThat(actualMinusResult).isEqualTo(minusResult) + } } From f7ddc42f564dbbe974b4ca6ee0e23a95b0d2aea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Tue, 31 Jan 2023 02:52:30 +0900 Subject: [PATCH 5/8] =?UTF-8?q?LottoNumberTest=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/malibin/study/domain/lotto/LottoNumberTest.kt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt new file mode 100644 index 0000000..2ac9bb2 --- /dev/null +++ b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt @@ -0,0 +1,3 @@ +package com.malibin.study.domain.lotto + +internal class LottoNumberTest From ad1f9bfe1c9a098299d542d8c242a66693f1bef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Tue, 31 Jan 2023 03:02:53 +0900 Subject: [PATCH 6/8] =?UTF-8?q?LottoNumberTest=20:=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=88=AB=EC=9E=90=EA=B0=80=201=EB=B3=B4=EB=8B=A4=20=EC=9E=91?= =?UTF-8?q?=EC=9D=80=20=EA=B2=BD=EC=9A=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../study/domain/lotto/LottoNumberTest.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt index 2ac9bb2..1f8c1cc 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt @@ -1,3 +1,20 @@ package com.malibin.study.domain.lotto -internal class LottoNumberTest +import com.google.common.truth.Truth +import org.junit.jupiter.api.Test + +internal class LottoNumberTest { + @Test + fun `입력 숫자는 1보다 작을 수 없다`() { + // given + val number = 0 + + // when + val exception = kotlin.runCatching { + LottoNumber.of(number) + }.exceptionOrNull() + + // then + Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) + } +} From c3fbfb55892f1a834fe5844d5d03e0a32f6d7f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Tue, 31 Jan 2023 03:04:23 +0900 Subject: [PATCH 7/8] =?UTF-8?q?LottoNumberTest=20:=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=88=AB=EC=9E=90=EA=B0=80=2045=EB=B3=B4=EB=8B=A4=20=ED=81=B0?= =?UTF-8?q?=20=EA=B2=BD=EC=9A=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../malibin/study/domain/lotto/LottoNumberTest.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt index 1f8c1cc..4f16c80 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt @@ -17,4 +17,18 @@ internal class LottoNumberTest { // then Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) } + + @Test + fun `입력 숫자는 45보다 클 수 없다`() { + // given + val number = 46 + + // when + val exception = kotlin.runCatching { + LottoNumber.of(number) + }.exceptionOrNull() + + // then + Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) + } } From ea92bae5e69c46cedb4dd3707598ced649716511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=88=E1=85=A1=E1=86=BC=E1=84=8C?= =?UTF-8?q?=E1=85=AE?= Date: Tue, 31 Jan 2023 03:17:35 +0900 Subject: [PATCH 8/8] =?UTF-8?q?LottoNumberTest=20:=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=88=AB=EC=9E=90=EA=B0=80=20=EB=A1=9C=EB=98=90=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EB=B2=94=EC=9C=84=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../malibin/study/domain/lotto/LottoNumberTest.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt index 4f16c80..9fb8179 100644 --- a/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt +++ b/domain/src/test/java/com/malibin/study/domain/lotto/LottoNumberTest.kt @@ -31,4 +31,16 @@ internal class LottoNumberTest { // then Truth.assertThat(exception).isInstanceOf(IllegalArgumentException::class.java) } + + @Test + fun `입력 숫자는 1 이상 45 이하의 범위여야 한다`() { + // given + val number = 10 + + // when + val actualNumber = LottoNumber.of(number) + + // then + Truth.assertThat(actualNumber.number).isEqualTo(number) + } }