From 861121ef3b72580c5304fa0f4cd4336e1058f92b Mon Sep 17 00:00:00 2001 From: forge-bot Date: Fri, 10 Jul 2026 18:02:28 +0000 Subject: [PATCH] =?UTF-8?q?PaymentService=20=EC=A0=95=EC=B1=85=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EC=A0=84=ED=99=98=20(BAIS-POLICY-1783705261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baispolicy/PaymentServiceTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/java/com/example/baispolicy/PaymentServiceTest.java diff --git a/src/test/java/com/example/baispolicy/PaymentServiceTest.java b/src/test/java/com/example/baispolicy/PaymentServiceTest.java new file mode 100644 index 0000000..e29ee02 --- /dev/null +++ b/src/test/java/com/example/baispolicy/PaymentServiceTest.java @@ -0,0 +1,25 @@ +package com.example.baispolicy; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +class PaymentServiceTest { + private final PaymentService paymentService = new PaymentService(); + + @Test + void testApprove_WithValidTransactionId_ShouldReturnApprovedMessage() { + String transactionId = "12345"; + String result = paymentService.approve(transactionId); + assertEquals("APPROVED:12345", result); + } + + @Test + void testApprove_WithBlankTransactionId_ShouldThrowException() { + assertThrows(IllegalArgumentException.class, () -> { + paymentService.approve(""); + }); + assertThrows(IllegalArgumentException.class, () -> { + paymentService.approve(null); + }); + } +}