package com.goldenchart.service; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class StrategyDslTimeframeNormalizerAlignTest { private final StrategyDslTimeframeNormalizer normalizer = new StrategyDslTimeframeNormalizer(new ObjectMapper()); @Test void alignSell_copiesBuyCandleTypesToSell() throws Exception { String buy = """ { "type": "TIMEFRAME", "candleType": "5m", "candleTypes": ["5m"], "children": [{ "type": "CONDITION", "condition": { "indicatorType": "RSI" } }] } """; String sell = """ { "type": "TIMEFRAME", "candleType": "1m", "children": [{ "type": "CONDITION", "condition": { "indicatorType": "RSI" } }] } """; String aligned = normalizer.alignSellStartTimeframeToBuy(buy, sell); assertTrue(aligned.contains("\"5m\"")); assertFalse(aligned.contains("\"candleType\":\"1m\"")); } }