Compare commits
2 commits
main
...
forge/BAIS
| Author | SHA1 | Date | |
|---|---|---|---|
| 06fe67bb40 | |||
| c8218e644d |
4 changed files with 4 additions and 68 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
# BAIS-POLICY-1783705261-attempt-3
|
# BAIS-POLICY-1783705261-attempt-1
|
||||||
|
|
||||||
Forge 이슈 작업 브랜치 `forge/BAIS-POLICY-1783705261-attempt-3`.
|
Forge 이슈 작업 브랜치 `forge/BAIS-POLICY-1783705261-attempt-1`.
|
||||||
39
pom.xml
39
pom.xml
|
|
@ -1,39 +0,0 @@
|
||||||
<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.baispolicy</groupId>
|
|
||||||
<artifactId>bais-policy</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>3.5.14</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>17</java.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
|
|
@ -3,8 +3,8 @@ package com.example.baispolicy;
|
||||||
public class PaymentService {
|
public class PaymentService {
|
||||||
public String approve(String transactionId) {
|
public String approve(String transactionId) {
|
||||||
if (transactionId == null || transactionId.isBlank()) {
|
if (transactionId == null || transactionId.isBlank()) {
|
||||||
throw new IllegalArgumentException("Transaction ID must not be blank.");
|
throw new IllegalArgumentException("Transaction ID cannot be blank");
|
||||||
}
|
}
|
||||||
return "APPROVED:" + transactionId;
|
return "APPROVED:" + transactionId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
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