PaymentService 정책 기반 전환 #1
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