직접입력값 평가오류

This commit is contained in:
Macbook
2026-06-17 23:45:39 +09:00
parent 3130de113b
commit d4b5814bbc
7 changed files with 220 additions and 24 deletions
@@ -0,0 +1,39 @@
package com.goldenchart.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
class StrategyConditionThresholdNormalizerTest {
private static final ObjectMapper MAPPER = new ObjectMapper();
@Test
void normalizesK50OverrideToHlMid() throws Exception {
JsonNode root = MAPPER.readTree("""
{
"type": "CONDITION",
"condition": {
"indicatorType": "RSI",
"conditionType": "CROSS_UP",
"leftField": "RSI_VALUE_9",
"rightField": "K_50",
"period": 9,
"valuePeriodOverride": true,
"thresholdOverride": true,
"targetValue": 50
}
}
""");
JsonNode normalized = StrategyConditionThresholdNormalizer.normalizeTree(root);
JsonNode cond = normalized.path("condition");
assertEquals("HL_MID", cond.path("rightField").asText());
assertFalse(cond.path("thresholdOverride").asBoolean(true));
assertFalse(cond.has("targetValue"));
}
}