PaymentService 승인 규칙 구현 #5

Merged
forge-bot merged 4 commits from forge/BAIS-SOURCE-1783702539-attempt-1 into main 2026-07-10 16:59:39 +00:00
Showing only changes of commit af5ee7ca80 - Show all commits

View file

@ -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());
}
}