Compare commits
3 commits
main
...
forge/BAIS
| Author | SHA1 | Date | |
|---|---|---|---|
| 5203a15252 | |||
| 94f5802531 | |||
| 784f647693 |
3 changed files with 67 additions and 0 deletions
3
.forge/BAIS-SPRING-ARC-002-attempt-1.md
Normal file
3
.forge/BAIS-SPRING-ARC-002-attempt-1.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# BAIS-SPRING-ARC-002-attempt-1
|
||||
|
||||
Forge 이슈 작업 브랜치 `forge/BAIS-SPRING-ARC-002-attempt-1`.
|
||||
40
src/main/java/com/example/lcf/LcfMappingRules.java
Normal file
40
src/main/java/com/example/lcf/LcfMappingRules.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package com.example.lcf;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public class LcfMappingRules {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LcfMappingRules.class);
|
||||
|
||||
public void lcfTry(Runnable action) {
|
||||
try {
|
||||
action.run();
|
||||
} catch (Exception e) {
|
||||
lcfSetErr(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void lcfSetErr(Exception e) {
|
||||
logger.error("Error occurred: ", e);
|
||||
// 추가적인 에러 처리 로직
|
||||
}
|
||||
|
||||
public void lcfLog(String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void batchCommit(Runnable batchAction) {
|
||||
try {
|
||||
batchAction.run();
|
||||
} catch (Exception e) {
|
||||
// 롤백 처리
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public double performDecimalOperation(double a, double b) {
|
||||
return a + b; // 예시로 덧셈을 수행
|
||||
}
|
||||
}
|
||||
24
src/test/java/com/example/lcf/LcfMappingRulesTest.java
Normal file
24
src/test/java/com/example/lcf/LcfMappingRulesTest.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package com.example.lcf;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class LcfMappingRulesTest {
|
||||
@Test
|
||||
void testLcfTry() {
|
||||
LcfMappingRules rules = new LcfMappingRules();
|
||||
Runnable action = mock(Runnable.class);
|
||||
doThrow(new RuntimeException("Test Exception")).when(action).run();
|
||||
|
||||
rules.lcfTry(action);
|
||||
// 예외가 발생했는지 확인하는 로직 추가
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPerformDecimalOperation() {
|
||||
LcfMappingRules rules = new LcfMappingRules();
|
||||
double result = rules.performDecimalOperation(5.0, 3.0);
|
||||
assertEquals(8.0, result);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue