Compare commits
6 commits
forge/BAIS
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| fec4828f0d | |||
| c8a931750f | |||
| af5ee7ca80 | |||
| 1d1a558cfc | |||
| 4ecbcc77c4 | |||
| a0a0a28cde |
4 changed files with 50 additions and 7 deletions
3
.forge/BAIS-SOURCE-1783702539-attempt-1.md
Normal file
3
.forge/BAIS-SOURCE-1783702539-attempt-1.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# BAIS-SOURCE-1783702539-attempt-1
|
||||
|
||||
Forge 이슈 작업 브랜치 `forge/BAIS-SOURCE-1783702539-attempt-1`.
|
||||
12
pom.xml
12
pom.xml
|
|
@ -1,17 +1,15 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>bais-gate-e2e</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.5</version>
|
||||
<version>3.2.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
|
@ -22,7 +20,7 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -39,4 +37,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
10
src/main/java/com/example/baisgate/PaymentService.java
Normal file
10
src/main/java/com/example/baisgate/PaymentService.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package com.example.baisgate;
|
||||
|
||||
public class PaymentService {
|
||||
public String approve(String transactionId) {
|
||||
if (transactionId == null || transactionId.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("Transaction ID cannot be blank");
|
||||
}
|
||||
return "APPROVED:" + transactionId;
|
||||
}
|
||||
}
|
||||
32
src/test/java/com/example/baisgate/PaymentServiceTest.java
Normal file
32
src/test/java/com/example/baisgate/PaymentServiceTest.java
Normal 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());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue