test: 전체 테스트 스위트 통과하도록 격리/기대값 수정 (115/115)
전체 스위트 실행 시 115개 중 28개가 실패하던 문제 처리.
1. 클래스별 JVM 격리 (25건)
TransformEngine/LayoutManager/MessageFactory 는 ApplicationContextProvider
기반의 JVM 전역 싱글턴이라, 한 JVM 에서 여러 테스트 클래스를 돌리면 마지막에
뜬 스프링 컨텍스트가 앞선 컨텍스트를 덮어쓴다. 그 결과 뒤 클래스가 앞 클래스의
레이아웃을 보게 되어 "cannot create message" 로 실패했다.
(각 클래스는 단독 실행 시에는 모두 통과)
→ build.gradle test 태스크에 forkEvery = 1 추가.
느려지는 부분은 maxParallelForks 로 상쇄 (7분 → 4분 28초).
2. GetTrinomialFunctionTest 기대값 정정 (2건)
JEP addStandardConstants() 에는 true/false 가 없고 Parser 가 이를 Boolean 으로
등록한다(Parser.addBooleanConstants). 테스트 setUp 도 Boolean 을 바인딩해 놓고
결과를 Number 로 단언하고 있어 자기모순이었음 → Boolean 기대로 정정.
3. LayoutRepositoryTest 시드 ID 수정 (1건)
시드 SQL 어디에도 없는 TST_TTST00000002_RES 를 조회하고 있었음
→ init_tseaitr07/08 에 존재하는 TST_TOSSTEST1_TGT 로 변경.
운영 코드 변경 없음 (build.gradle 테스트 설정 + 테스트 코드만).
This commit is contained in:
@@ -92,6 +92,16 @@ dependencies {
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
||||
// TransformEngine/LayoutManager/MessageFactory 는 ApplicationContextProvider 기반의
|
||||
// JVM 전역 싱글턴이다. 한 JVM 에서 여러 테스트 클래스를 돌리면 마지막에 뜬 스프링
|
||||
// 컨텍스트가 앞선 컨텍스트를 덮어써서, 뒤 클래스가 앞 클래스의 레이아웃을 보게 된다
|
||||
// ("cannot create message" 오류). 클래스마다 JVM 을 새로 띄워 격리한다.
|
||||
forkEvery = 1
|
||||
|
||||
// 클래스별 JVM 분리로 느려지는 것을 CPU 코어 수만큼 병렬 실행해 상쇄한다.
|
||||
// 포크마다 별도 JVM(=별도 H2 인메모리 DB)이라 서로 간섭하지 않는다.
|
||||
maxParallelForks = Math.max(1, Runtime.runtime.availableProcessors().intdiv(2))
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
||||
@@ -146,17 +146,17 @@ class GetTrinomialFunctionTest {
|
||||
// ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
@DisplayName("실전 패턴 — true/false 결과값 (JEP 상수 1.0/0.0 반환 검증)")
|
||||
@DisplayName("실전 패턴 — true/false 결과값 (Boolean 타입 반환 검증)")
|
||||
void testBooleanLiteralReturnValue() {
|
||||
// JEP addStandardConstants()가 true=1.0, false=0.0 으로 등록하는지 확인
|
||||
// → 등록되어 있다면 변수 바인딩 없이 숫자로 반환됨
|
||||
// → 등록 안 됐다면 파싱 오류 또는 undeclared 변수(NaN)로 처리됨
|
||||
// JEP addStandardConstants() 에는 true/false 가 없다.
|
||||
// Parser 가 이를 Boolean 으로 직접 등록하므로(Parser.addBooleanConstants),
|
||||
// 결과값은 숫자 1.0/0.0 이 아니라 Boolean 이다. setUp 도 동일하게 바인딩한다.
|
||||
jep.addVariable("intVal", 10.0);
|
||||
Object result = eval("getTrinomial(intVal, 10, \"=\", true, false)");
|
||||
assertTrue(result instanceof Number,
|
||||
"true/false 결과값이 Number 타입이어야 함 (실제: " + result.getClass().getSimpleName() + ")");
|
||||
assertEquals(1.0, ((Number) result).doubleValue(), 0.0,
|
||||
"조건 참일 때 true(=1.0) 반환 기대");
|
||||
assertTrue(result instanceof Boolean,
|
||||
"true/false 결과값이 Boolean 타입이어야 함 (실제: " + result.getClass().getSimpleName() + ")");
|
||||
assertEquals(Boolean.TRUE, result,
|
||||
"조건 참일 때 true 반환 기대");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -197,9 +197,9 @@ class GetTrinomialFunctionTest {
|
||||
assertFalse(jep.hasError(), "평가 오류: " + jep.getErrorInfo());
|
||||
}
|
||||
|
||||
assertTrue(result instanceof Number,
|
||||
"결과값이 Number 타입이어야 함 (실제: " + (result == null ? "null" : result.getClass().getSimpleName()) + ")");
|
||||
assertEquals(1.0, ((Number) result).doubleValue(), 0.0,
|
||||
"INT_VALUE=10, 비교값=10, 연산자=등호 → 참(true=1.0) 반환 기대");
|
||||
assertTrue(result instanceof Boolean,
|
||||
"결과값이 Boolean 타입이어야 함 (실제: " + (result == null ? "null" : result.getClass().getSimpleName()) + ")");
|
||||
assertEquals(Boolean.TRUE, result,
|
||||
"INT_VALUE=10, 비교값=10, 연산자=등호 → 참(true) 반환 기대");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class LayoutRepositoryTest {
|
||||
|
||||
@Test
|
||||
void testFindById() {
|
||||
LayoutEntity layoutEntity = layoutLoaderRepository.getReferenceById("TST_TTST00000002_RES");
|
||||
LayoutEntity layoutEntity = layoutLoaderRepository.getReferenceById("TST_TOSSTEST1_TGT");
|
||||
layoutEntity = layoutEntity.getLayoutItemEntities().stream().findAny().get().getLayoutEntity();
|
||||
assertNotNull(layoutEntity);
|
||||
System.out.println(layoutEntity);
|
||||
|
||||
Reference in New Issue
Block a user