PaymentService 정책 기반 전환 (BAIS-POLICY-1783705261)
All checks were successful
ci / test (pull_request) Successful in 1m20s
All checks were successful
ci / test (pull_request) Successful in 1m20s
This commit is contained in:
parent
1d34b48888
commit
861121ef3b
1 changed files with 25 additions and 0 deletions
25
src/test/java/com/example/baispolicy/PaymentServiceTest.java
Normal file
25
src/test/java/com/example/baispolicy/PaymentServiceTest.java
Normal file
|
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue