From af5ee7ca80de0def6182804dc9d7603ea4d74294 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Fri, 10 Jul 2026 16:56:00 +0000 Subject: [PATCH] =?UTF-8?q?PaymentService=20=EC=8A=B9=EC=9D=B8=20=EA=B7=9C?= =?UTF-8?q?=EC=B9=99=20=EA=B5=AC=ED=98=84=20(BAIS-SOURCE-1783702539)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/baisgate/PaymentServiceTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test/java/com/example/baisgate/PaymentServiceTest.java diff --git a/src/test/java/com/example/baisgate/PaymentServiceTest.java b/src/test/java/com/example/baisgate/PaymentServiceTest.java new file mode 100644 index 0000000..1caa7a9 --- /dev/null +++ b/src/test/java/com/example/baisgate/PaymentServiceTest.java @@ -0,0 +1,32 @@ +package com.example.baisgate; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +class PaymentServiceTest { + + @Test + void testApprove_WithValidTransactionId_ReturnsApproved() { + PaymentService paymentService = new PaymentService(); + String result = paymentService.approve("12345"); + assertEquals("APPROVED:12345", result); + } + + @Test + void testApprove_WithBlankTransactionId_ThrowsIllegalArgumentException() { + PaymentService paymentService = new PaymentService(); + Exception exception = assertThrows(IllegalArgumentException.class, () -> { + paymentService.approve(""); + }); + assertEquals("Transaction ID cannot be blank", exception.getMessage()); + } + + @Test + void testApprove_WithNullTransactionId_ThrowsIllegalArgumentException() { + PaymentService paymentService = new PaymentService(); + Exception exception = assertThrows(IllegalArgumentException.class, () -> { + paymentService.approve(null); + }); + assertEquals("Transaction ID cannot be blank", exception.getMessage()); + } +} \ No newline at end of file