직접입력값 평가오류
This commit is contained in:
+39
@@ -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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user