From 853fd57e8f8fa8f0a94b66d82508cc2adf987295 Mon Sep 17 00:00:00 2001 From: Joowon Lim Date: Thu, 21 Mar 2024 21:27:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Test:=20=EC=9E=91=EC=9D=80,=20=EC=A4=91?= =?UTF-8?q?=EA=B0=84,=20=ED=81=B0=20=EA=B8=88=EC=95=A1=20=ED=8F=AC?= =?UTF-8?q?=EC=9D=B8=ED=8A=B8=20=EA=B3=84=EC=82=B0=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/point/DefaultPointPolicyTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java diff --git a/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java b/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java new file mode 100644 index 0000000..2db4264 --- /dev/null +++ b/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java @@ -0,0 +1,48 @@ +package com.readyvery.readyverydemo.src.point; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class DefaultPointPolicyTest { + @InjectMocks + private DefaultPointPolicy defaultPointPolicy; + + @Test + @DisplayName("작은 금액 테스트") + void calculateSmallPoint() { + // given + Long amount = 1_050L; // 계산 금액 + // when + Long point = defaultPointPolicy.calculatePoint(amount); + // then + assertEquals(26L, point); + } + + @Test + @DisplayName("보통 금액 테스트") + void calculateNomalPoint() { + // given + Long amount = 10_000L; // 계산 금액 + // when + Long point = defaultPointPolicy.calculatePoint(amount); + // then + assertEquals(250L, point); + } + + @Test + @DisplayName("큰 금액 테스트") + void calculateBigPoint() { + // given + Long amount = 532_400L; // 계산 금액 + // when + Long point = defaultPointPolicy.calculatePoint(amount); + // then + assertEquals(13_310L, point); + } +} \ No newline at end of file From 85a09bbb983d663218429aea48680140e1804def Mon Sep 17 00:00:00 2001 From: Joowon Lim Date: Thu, 21 Mar 2024 21:31:12 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Style:=20=EC=BB=A8=EB=B2=A4=EC=85=98=20?= =?UTF-8?q?=EC=A4=80=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../readyverydemo/src/point/DefaultPointPolicyTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java b/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java index 2db4264..41e08bc 100644 --- a/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java +++ b/src/test/java/com/readyvery/readyverydemo/src/point/DefaultPointPolicyTest.java @@ -45,4 +45,4 @@ void calculateBigPoint() { // then assertEquals(13_310L, point); } -} \ No newline at end of file +}